#include<stdio.h>
 
int main(void){
  int n,count;
  scanf("%d",&n);
  
  char s[n][11];
  for(int i = 0;i < n;i++)
    scanf("%s",s[i]);
  
  char check[n][11];
  for(int i = 0;i < n;i++)
    check[i][0] = '\0';
  
  for(int i = 0;i < n;i++){
    int flag = 1;
    int j = 0;
    while(check[j][0] != '\0' && flag){
      int a = 0;
      for(int k = 0;k < 11;k++){
        if(check[j][k] == s[i][k])
          a++;
      }
      if(a = 11)
        flag = 0;
      j++;
    }
    
    if(flag){
      j = 0;
      while(check[j][0] != '\0')
        j++;
      for(int k = 0;k < 11;k++)
        check[j][k] = s[i][k];
      count = j+1;
    }
  }
  printf("%d",count);

  return 0;
}