#include <bits/stdc++.h>
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
const long long M = 1000000007ll;
const long long MOD = 1000000007ll;
const long long MAX = 100000001ll;
const int N = 100000;
struct UnionFind {
  vector<int> d;
  UnionFind(int n = 0) : d(n, -1) {}
  int root(int x) {
    if (d[x] < 0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int size(int x) { return -d[root(x)]; }
  int factor_size() {
    int ans = 0;
    for (long long i = 0; i < (d.size()); i++) {
      if (d[i] < 0) {
        ans++;
      }
    }
    return ans;
  }
};
int main() {
  int n, m, k, q;
  cin >> n;
  int s[n + 1];
  s[0] = 0;
  for (long long i = 0; i < (n); i++) {
    cin >> q;
    s[i + 1] = s[i] + q;
  }
  int ans = 0;
  sort(s, s + n + 1);
  for (int i = 0; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (s[i] == s[j])
        ans++;
      else
        break;
    }
  }
  cout << ans << endl;
}
