#include<iostream>
using namespace std;
int main ()
{
int n,x[200],c=0;
cin>>n;
for(int i=1;i<=n;i++)
cin>>x[i];
for(int i=1;i<n;i++)
{
int aux=x[n];
while(x[i]!=aux)
{
if(x[i]>aux) x[i]-=aux;
else if(x[i]<aux) aux-=x[i];
}
if(x[i]==1) c++;
}
cout<<c;
return 0;
}