#include <iostream>
#include <algorithm>
using namespace std;
int main(void) {
    int N;
    int K, ans =0;
    while (cin >> N) {
        K = N-1;
        if (N == 0) break;
        vector<long long> a(N);
        for (int i = 0; i < N; ++i) cin >> a[i];

        // 累積和を前計算
        vector<int> s(N+1, 0);
        for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i];

        // 答えを求める
        long long res = s[0]; // 最初は無限小の値に初期化しておく
        for (int i = 0; i <= N-K; ++i) {
            long long val = s[K+i] - s[i];
            if (res == val) ans++;
        }
        cout << ans << endl;
    }
}