#include<stdio.h>
int main(){
    int n;
    int i;
    int j;
    int number[10000];
    int count = 0;
    
    scanf("%d",&n);
    
    for(i = 0;i<n;i++){
        scanf("%d",&number[i]);
    if(number[i] == 2) count++;
    else if(number[i] % j == 0) break;
    else if(number[i] - 1 == j) count++; break;
    else continue;
    }
    printf("%d\n",count);
    return 0;
    
}

