#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int a[350];
int main()
{
    int n;
    while (cin >> n)
    {
        for (int i = 1; i <= n; i++)
            scanf("%d", a + i);
        for (int i = 2; i <= n; i++)
            a[i] += a[i - 1];
        int sum = a[n];
        int cnt = 0;
        for (int i = 0; i < n; i++)
            for (int j = 0; j < i; j++)
                if (2 * (a[i] - a[j]) == sum)
                    cnt++;
        cout << (1ll * cnt * (cnt - 1) / 2) << endl;
    }
    return 0;
}
