#include<stdio.h>
int a[20000], b[20000];
int main()
{
int n;
while (scanf("%d", &n), n != 0)
{
for (int i = 0; i <2* n; i++)
{
scanf("%d", &a[i]);
b[i] = a[i];
}
for (int i = 1; i <2* n; i++)//前缀和
{
a[i] += a[i - 1];
b[2*n - 1 - i] += b[2*n - i];
}
int cnt1 = 0, cnt2 = 2 * n - 1, ans = 0;
while (cnt1 < 2 * n && cnt2 >= 0)
{
if (a[cnt1] == b[cnt2])
{
ans++;
cnt1++;
cnt2--;
}
else if(a[cnt1] > b[cnt2])cnt2--;
else cnt1++;
}
printf("%d\n", ans);
}
return 0;
}