#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  vector<long long> b;
  scanf("%d", &a);
  long long sum = 0;
  int count = 0;
  for (int i = 0; i < a; i++) {
    long long c;
    scanf("%lld", &c);
    b.push_back(c);
    sum += c;
    if (c == 0) {
      count++;
    }
    if (sum == 0) {
      count++;
    }
    long long temp = sum;
    for (int j = 0; j < i - 1; j++) {
      long long sum2 = 0;
      sum2 += b[j];
      temp -= sum2;
      if (temp == 0) {
        count++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
