#include <bits/stdc++.h>
const int INF = 1e5;
const int MOD = 1e9 + 7;
using namespace std;
int main() {
  int ans = 0;
  int n;
  cin >> n;
  vector<int> v;
  v.clear();
  int a = 0;
  int s[n];
  for (int i = 0; i < (n); i++) {
    cin >> a;
    if (i == 0) {
      s[i] = a;
    } else {
      s[i] = s[i - 1] + a;
    }
  }
  for (int i = 0; i < (n); i++) {
    v.push_back(s[i]);
  }
  for (int i = 0; i < (n); i++) {
    int b = *(v.begin());
    size_t n_count = std::count(v.begin(), v.end(), 0);
    ans += n_count;
    v.erase(v.begin());
    for (int i = 0; i < v.size(); i++) {
      v[i] -= b;
    }
  }
  cout << ans << endl;
  return 0;
}
