import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[11];
Arrays.fill(a, -1);
int res = 0;
while (n-- > 0) {
int x = sc.nextInt(), y = sc.nextInt();
if (a[x] != -1) {
res += a[x] ^ y;
}
a[x] = y;
}
System.out.println(res);
}
}