#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 11;
int n;
int st[N];
int main()
{
cin>>n;
memset(st,-1,sizeof st);
int ans = 0;
for (int i = 0; i < n; i ++ )
{
int id,x;
cin>>id>>x;
if(st[id] == -1) st[id] = x;
else
{
if(x != st[id]) ans++;
st[id] = x;
}
}
cout<<ans<<endl;
return 0;
}