#include <bits/stdc++.h>
using namespace std;
const long double PI = (acos(-1));
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
long long mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vector<int> s(n + 1, 0);
  s[0] = 0;
  for (int i = 1; i < (int)(n + 1); i++) {
    s[i] = s[i - 1] + a[i - 1];
  }
  int ans = 0;
  for (int i = 0; i < (int)(n + 1); i++) {
    for (int j = i + 1; j < (int)(n + 1); j++) {
      if (s[j] - s[i] == 0) ans++;
    }
  }
  cout << ans;
  return 0;
}
