#include <bits/stdc++.h>
using namespace std;
const int N = 1000000;
const int mod = 1000000007;
const int INF = 1 << 30;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string YN(bool b) { return (b ? "YES" : "NO"); }
string yn(bool b) { return (b ? "Yes" : "No"); }
long long int n, ans = 0, v[2 * 100010], sum[2 * 100010];
string s, ss, sss;
int main() {
  cin >> n;
  for (long long int i = (long long int)0; i < (long long int)n; ++i)
    cin >> v[i], sum[i] = (i == 0 ? v[i] : sum[i - 1] + v[i]);
  for (long long int i = -1; i < n; ++i)
    for (long long int j = i + 1; j < n; ++j) {
      long long int num = (i == -1 ? sum[j] : sum[j] - sum[i]);
      if (num == 0) ++ans;
    }
  cout << ans << endl;
  return 0;
}
