#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  static long long A[200010];
  static long long sum_table[200010];
  for (int i = (0); i < (N); ++i) cin >> A[i];
  int count = 0;
  long long part_sum = 0;
  for (int i = (0); i < (N); ++i) {
    part_sum += A[i];
    sum_table[i] = part_sum;
    if (part_sum == 0) count++;
  }
  for (int i = (1); i < (N); ++i) {
    for (int j = (i); j < (N); ++j) {
      if (sum_table[j] - sum_table[i - 1] == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
  system("pause");
  return 0;
}
