#include <iostream>
using namespace std;

int main() {
   int n, k, l, c;
   cin>>n;
   int a[n];
   int b[n];
   l=1;
   int k=1;
   for(int i=0;i<n;i++){
       cin>>x;
       a[i]=x;
       cin>>y;
       b[i]=y;
   }
       while(l<n){
        if(a[l]!=a[l-1]){
            k++;
        }
        l++;
       }
       cout<<k;
}