#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long line[N + 1];
  line[0] = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    line[i + 1] = line[i] + a;
  }
  sort(line, line + N + 1);
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (line[i] == line[i + 1]) ans++;
  }
  cout << ans << endl;
}
