#include <bits/stdc++.h>
using namespace std;
static const int INF = 1e+9 + 7;
long long n, m, l;
string s, t;
long long d[200010], dp[300][300];
char field[200][200];
int main() {
  cin >> n;
  for (long long i = (0); i < (n); i++) {
    cin >> m;
    d[i + 1] = d[i] + m;
  }
  sort(d + 1, d + n + 1);
  long long ans = 0;
  m = d[0];
  for (long long i = (0); i <= (n); i++) {
    for (long long j = (i + 1); j <= (n); j++) {
      if (d[i] == d[j])
        ans++;
      else
        break;
    }
  }
  cout << (ans) << "\n";
  return 0;
}
