#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  vector<int> S;
  scanf("%d", &N);
  S.push_back(0);
  int cnt = 0;
  for (int i = 1; i <= N; i++) {
    int x;
    scanf("%d", &x);
    S.push_back(x + S[i - 1]);
    for (int k = 0; k < i; k++)
      if (S[i] == S[k]) cnt++;
  }
  printf("%d\n", cnt);
  return 0;
}
