728x90
#include <iostream>
#include <vector>
int n;
using namespace std;
int main() {
cin >> n;
vector<int>check(11, 2);
int num, loc;
int cnt = 0;
for (int i = 0; i < n; i++) {
cin >> num;
cin >> loc;
if (check[num] == 2) {
check[num] = loc;
continue;
}
if (check[num] != loc) {
cnt++;
check[num] = loc;
}
}
cout << cnt << endl;
}