#include <map>
#include <iostream>
using namespace std;
int n, res;
map <int,int>mp;
int main(){
cin >> n;
while (n -- ){
int x, y;
cin >> x >> y;
if(!mp.count(x))mp[x] = y;
else {
if(mp[x] == y)continue;
else res ++ ,mp[x] = y;
}
}
cout << res << endl;
return 0;
}