#include <bits/stdc++.h>
using namespace std;
long long dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
          dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
template <class T>
inline bool maxi(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool mini(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int mxn = 200000;
int n, in[mxn], sum[mxn], ctr = 0;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cin >> n;
  in[0] = 0;
  sum[0] = 0;
  for (int i = (1), i_len = (n + 1); i < i_len; ++i) {
    cin >> in[i];
    sum[i] = sum[i - 1] + in[i];
  }
  for (int i = (0), i_len = (n); i < i_len; ++i)
    for (int j = (i + 1), j_len = (n); j <= j_len; ++j) {
      if (!(sum[j + 1] - in[i])) ctr++;
    }
  cout << (ctr) << "\n";
  1;
}
