#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
signed main()
  int a;
  cin>>a;
  vector<int> b;
  rep(i,a)
  cin>>b[i];
  int c[a+1];
  c[0]=0;
  rep1(i,a)
    c[i]=b[i-1]+c[i-1];
  int d=0;
  rep(i,a+1)rep(j,a+1){
  if(c[i]==c[j])
    d++;
  }
cout<<d/2<<endl;
}