#include <stdio.h>
int main(void)
{
  int N,x,y,m=2;
  scanf("%d", &N);
  scanf("%d %d", &x, &y);
  while(N>2)
  {
    int u,w;
    scanf("%d %d", &u, &w);
    if(u==x) m=2;
    else m=1;
    N--;
    x=u;
  }
  printf("%d", m);
}