#include <bits/stdc++.h>
using namespace std;
const long long LongINF = 1e13 + 7;
const int INF = 1e9 + 7;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T, class Y>
T GCD(T a, Y b) {
  if (a < b) {
    int c = a;
    a = b;
    b = c;
  }
  if (a % b == 0) {
    return b;
  }
  return GCD(b, a % b);
}
void clear(queue<pair<int, int>>& q) {
  queue<pair<int, int>> empty;
  swap(q, empty);
}
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (N); i++) cin >> A[i];
  vector<long long> D(N + 1, 0);
  for (long long i = 0; i < N; i++) {
    D[i + 1] = D[i] + A[i];
  }
  long long ANS = 0;
  for (long long i = 0; i <= N; i++) {
    for (long long j = i + 1; j <= N; j++) {
      if (D[j] - D[i] == 0) ANS++;
    }
  }
  cout << ANS << endl;
  return 0;
}
