#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a.at(i);
  int right = 0;
  long long s = 0;
  long long res = a.at(0);
  for (int left = 0; left < N; left++) {
    if (left > 0) s -= a.at(left - 1);
    while (right < N - 1 && s != 0) {
      right++;
      s += a.at(right);
    }
    if (s == 0) res++;
    if (right == left) right++;
  }
  cout << res;
}
