#include <bits/stdc++.h>
using namespace std;
long long INFL = 1000000000000000010;
int INF = 2000000000;
long long MOD = 998244353;
int N;
vector<long long> A(100010);
vector<long long> W(100010);
int main() {
  cin >> N;
  W.at(0) = 0;
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    W.at(i + 1) = W.at(i) + A.at(i);
  }
  int cnt = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = i; j <= N; j++) {
      if (W.at(j) - W.at(i - 1) == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}
