#include <bits/stdc++.h>
using namespace std;

int main () {
    int n; cin >> n;

    int a[n + 1] = {}, t;
    cin >> a[1];
    for(int i =2; i <= n; i++) {
        cin >> t;
        a[i] = a[i - 1] + t;
    }

    int ans = 0;
    for (int i = 0; i < n; i++)
        for (int j = i + 1; j <= n; j++)
            if (a[j] - a[i] == 0)
                ans++;

    cout << ans;
}