#include <iostream>using namespace std;int n,a[101],i,j,nr;int main(){ cin>>n;nr=0; for (int i=1;i<=n;i++) cin>>a[i]; i=1,j=n; while (i<=j) { while (a[i]!=a[j] && a[i]!=0 && a[j]!=0) if(a[i]>a[j]) a[i]-=a[j]; else a[j]-=a[i]; if (a[i]==1 || a[j]==1) nr++; } cout<<nr; return 0;}