#include <iostream>
using namespace std;
short v[201];
int main()
{
short n, i, a, b, c=0, r;
cin >> n;
for (i=1; i<=n; ++i) cin >> v[i];
for (i=1; i<=n/2; ++i)
{
a=v[i]; b=v[n+1-i];
while (b!=0)
{
r=a%b; a=b; b=r;
}
if (a==1) ++c;
}
cout << c;
return 0;
}