Tanya has $n$ candies numbered from $1$ to $n$. The $i$-th candy has the weight $a_i$.

She plans to eat exactly $n-1$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.

Your task is to find the number of such candies $i$ (let's call these candies good) that if dad gets the $i$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days. Note that at first, she will give the candy, after it she will eat the remaining candies one by one.

For example, $n=4$ and weights are $[1, 4, 3, 3]$. Consider all possible cases to give a candy to dad:  Tanya gives the $1$-st candy to dad ($a_1=1$), the remaining candies are $[4, 3, 3]$. She will eat $a_2=4$ in the first day, $a_3=3$ in the second day, $a_4=3$ in the third day. So in odd days she will eat $4+3=7$ and in even days she will eat $3$. Since $7 \ne 3$ this case shouldn't be counted to the answer (this candy isn't good).  Tanya gives the $2$-nd candy to dad ($a_2=4$), the remaining candies are $[1, 3, 3]$. She will eat $a_1=1$ in the first day, $a_3=3$ in the second day, $a_4=3$ in the third day. So in odd days she will eat $1+3=4$ and in even days she will eat $3$. Since $4 \ne 3$ this case shouldn't be counted to the answer (this candy isn't good).  Tanya gives the $3$-rd candy to dad ($a_3=3$), the remaining candies are $[1, 4, 3]$. She will eat $a_1=1$ in the first day, $a_2=4$ in the second day, $a_4=3$ in the third day. So in odd days she will eat $1+3=4$ and in even days she will eat $4$. Since $4 = 4$ this case should be counted to the answer (this candy is good).  Tanya gives the $4$-th candy to dad ($a_4=3$), the remaining candies are $[1, 4, 3]$. She will eat $a_1=1$ in the first day, $a_2=4$ in the second day, $a_3=3$ in the third day. So in odd days she will eat $1+3=4$ and in even days she will eat $4$. Since $4 = 4$ this case should be counted to the answer (this candy is good). 

In total there $2$ cases which should counted (these candies are good), so the answer is $2$.


-----Input-----

The first line of the input contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of candies.

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^4$), where $a_i$ is the weight of the $i$-th candy.


-----Output-----

Print one integer — the number of such candies $i$ (good candies) that if dad gets the $i$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.


-----Examples-----
Input
7
5 5 4 5 5 5 6

Output
2

Input
8
4 8 8 7 8 4 4 5

Output
2

Input
9
2 3 4 2 2 3 2 2 4

Output
3



-----Note-----

In the first example indices of good candies are $[1, 2]$.

In the second example indices of good candies are $[2, 3]$.

In the third example indices of good candies are $[4, 5, 9]$.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
n = int(input())
a = list(map(int, input().split()))
c = 0
s = d = 0
for i in range(1, n):
	if i % 2 == 1:
		s += a[i]
	else:
		d += a[i]
if s == d:
	c += 1
for i in range(1, n):
	if i % 2 == 1:
		s = s + a[i - 1] - a[i]
		if s == d:
			c += 1
	else:
		d = d + a[i - 1] - a[i]
		if s == d:
			c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
s1 = sum(a[1::2])
s2 = sum(a[2::2])
r = 0
if s1 == s2:
	r += 1
for i in range(1, n):
	if i % 2 == 1:
		s1 -= a[i]
		s1 += a[i - 1]
	else:
		s2 -= a[i]
		s2 += a[i - 1]
	if s1 == s2:
		r += 1
print(r)


n = int(input())
a = [int(t) for t in input().split(' ')]
prefix_odd = [0]
prefix_even = [0]
for i in range(len(a)):
	if i % 2 == 0:
		prefix = prefix_even
		antiprefix = prefix_odd
	else:
		prefix = prefix_odd
		antiprefix = prefix_even
	prefix.append(prefix[-1] + a[i])
	antiprefix.append(antiprefix[-1])
count = 0
for i in range(len(a)):
	sum_even = prefix_even[i] + prefix_odd[-1] - prefix_odd[i + 1]
	sum_odd = prefix_odd[i] + prefix_even[-1] - prefix_even[i + 1]
	if sum_even == sum_odd:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
o = [a[0]]
e = [0]
for i in range(1, n):
	o.append(o[i - 1] if i % 2 == 1 else o[i - 1] + a[i])
	e.append(e[i - 1] if i % 2 == 0 else e[i - 1] + a[i])
c = 0
for i in range(1, n):
	od = o[i] - a[i] + e[-1] - e[i - 1]
	ev = e[i] - a[i] + o[-1] - o[i - 1]
	if od == ev:
		c += 1
se = so = 0
for i in range(n):
	se += a[i] if i % 2 == 1 else 0
	so += a[i] if i % 2 == 0 else 0
if se == so - a[0]:
	c += 1
print(c)


n = int(input())
a = [int(x) for x in input().split()]
even = []
odd = []
for i in range(n):
	if i % 2 == 0:
		even += [a[i]]
	else:
		odd += [a[i]]
pe = [0] * (len(even) + 1)
po = [0] * (len(odd) + 1)
for i in range(1, len(even) + 1):
	pe[i] = pe[i - 1] + even[i - 1]
for i in range(1, len(odd) + 1):
	po[i] = po[i - 1] + odd[i - 1]

def aa(i, j):
	if i % 2 == 0:
		se = pe[(i + 1) // 2] + po[-1] - po[i // 2]
		so = po[i // 2] + pe[-1] - pe[(i + 1) // 2] - a[j]
	else:
		se = pe[(i + 1) // 2] + po[-1] - po[i // 2] - a[j]
		so = po[i // 2] + pe[-1] - pe[(i + 1) // 2]
	return se == so
c = 0
for i in range(n):
	if aa(i, i):
		c += 1
print(c)


import math
n = int(input())
arr = list(map(int, input().split()))
oddsum = 0
evensum = 0
for i in range(n):
	if i % 2 == 0:
		oddsum += arr[i]
	else:
		evensum += arr[i]
currodd = 0
curreven = 0
ans = 0
for i in range(n):
	if i % 2 == 0:
		odd = currodd + (evensum - curreven)
		even = curreven + (oddsum - currodd - arr[i])
		if even == odd:
			ans += 1
		currodd += arr[i]
	else:
		even = currodd + (evensum - curreven - arr[i])
		odd = curreven + (oddsum - currodd)
		if even == odd:
			ans += 1
		curreven += arr[i]
print(ans)


n = int(input())
l = list(map(int, input().split()))
(o, e) = (0, 0)
r = []
for i in range(n):
	r.append([o, e])
	if i % 2 == 0:
		o += l[i]
	else:
		e += l[i]
(e, o) = (0, 0)
for i in range(n - 1, -1, -1):
	r[i][0] += o
	r[i][1] += e
	if i % 2 == 0:
		e += l[i]
	else:
		o += l[i]
c = 0
for (i, j) in r:
	if i == j:
		c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
s_l = [0] * n
s = 0
i = n - 1
while i >= 0:
	if i % 2 == 0:
		s += a[i]
	else:
		s -= a[i]
	s_l[i] = s
	i -= 1
s = 0
ans = 0
for i in range(n - 1):
	if s + s_l[i + 1] == 0:
		ans += 1
	if i % 2 == 0:
		s -= a[i]
	else:
		s += a[i]
if s == 0:
	ans += 1
print(ans)


n = int(input())
a_list = list(map(int, input().split())) + [0]
left_even_minus_odd = [0] * n
right_even_minus_odd = [0] * (n + 1)
res = 0
for i in range(n):
	left_even_minus_odd[i] = left_even_minus_odd[i - 1] + (-1) ** i * a_list[i - 1]
for i in range(n - 1, -1, -1):
	right_even_minus_odd[i] = right_even_minus_odd[i + 1] + (-1) ** (n - 1 - i) * a_list[i + 1]
	if right_even_minus_odd[i] + (-1) ** n * left_even_minus_odd[i] == 0:
		res += 1
print(res)


n = int(input())
an = list(map(int, input().split()))
s0 = sum(an)
s1 = sum(an[::2])
s2 = s0 - s1
res = 0
s3 = 0
s4 = 0
for i in range(0, len(an)):
	if i % 2 == 0:
		if (s0 - an[i]) % 2 == 0 and s3 + s2 - s4 == (s0 - an[i]) // 2:
			res += 1
		s3 += an[i]
	else:
		if (s0 - an[i]) % 2 == 0 and s3 + s2 - s4 - an[i] == (s0 - an[i]) // 2:
			res += 1
		s4 += an[i]
print(res)


n = int(input())
ai = list(map(int, input().split()))
ai2 = [[0, 0] for i in range(n + 1)]
ai2[1][1] = ai[0]
for i in range(2, n + 1):
	ai2[i][0] = ai2[i - 1][0] + ai[i - 1] * (1 - i % 2)
	ai2[i][1] = ai2[i - 1][1] + ai[i - 1] * (i % 2)
ans = 0
flag = n % 2
for i in range(1, n):
	if flag:
		num3 = ai2[-1][1] - ai[i - 1] * (i % 2)
		num4 = ai2[-1][0] - ai[i - 1] * (1 - i % 2)
	else:
		num3 = ai2[-1][1] - ai[i - 1] * (i % 2)
		num4 = ai2[-1][0] - ai[i - 1] * (1 - i % 2)
	num = ai2[i - 1][0] + num3 - ai2[i - 1][1]
	num2 = ai2[i - 1][1] + num4 - ai2[i - 1][0]
	if num == num2:
		ans += 1
if ai2[-2][0] == ai2[-2][1]:
	ans += 1
print(ans)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, OrderedDict
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
n = intIn()
if n == 1:
	print(1)
	exit(0)
elif n == 2:
	print(0)
	exit(0)
a = listIn()
count = 0
evenf = [0] * n
evenr = [0] * n
oddf = [0] * n
oddr = [0] * n
b = a[::-1]
for i in range(n):
	if i % 2 == 0:
		oddf[i] += a[i] + oddf[i - 1]
		oddr[i] += b[i] + oddr[i - 1]
		if i > 0:
			evenf[i] += evenf[i - 1]
			evenr[i] = evenr[i - 1]
	else:
		oddf[i] = oddf[i - 1]
		oddr[i] = oddr[i - 1]
		evenf[i] += a[i] + evenf[i - 1]
		evenr[i] += b[i] + evenr[i - 1]
oddr = oddr[::-1]
evenr = evenr[::-1]
for i in range(n):
	if n % 2 != 0:
		if i == 0:
			oSum = oddr[i + 2]
			eSum = evenr[i + 1]
		elif i == n - 1:
			oSum = oddf[i - 2]
			eSum = evenf[i - 1]
		elif i % 2 == 1:
			if i + 2 < n:
				oSum = oddf[i - 1] + evenr[i + 2]
			else:
				oSum = oddf[i - 1]
			if i - 2 > 0:
				eSum = evenf[i - 2] + oddr[i + 1]
			else:
				eSum = oddr[i + 1]
		else:
			if i + 1 < n:
				oSum = oddf[i - 2] + evenr[i + 1]
			else:
				oSum = oddf[i - 2]
			if i + 2 < n:
				eSum = evenf[i - 1] + oddr[i + 2]
			else:
				eSum = evenf[i - 1]
	elif i == 0:
		oSum = oddr[i + 1]
		eSum = evenr[i + 2]
	elif i == n - 1:
		oSum = oddf[i - 1]
		eSum = evenf[i - 2]
	elif i % 2 == 1:
		if i + 2 < n:
			oSum = oddf[i - 1] + oddr[i + 2]
		else:
			oSum = oddf[i - 1]
		if i - 2 > 0:
			eSum = evenf[i - 2] + evenr[i + 1]
		else:
			eSum = evenr[i + 1]
	else:
		if i + 1 < n:
			oSum = oddf[i - 2] + oddr[i + 1]
		else:
			oSum = oddf[i - 2]
		if i + 2 < n:
			eSum = evenf[i - 1] + evenr[i + 2]
		else:
			eSum = evenf[i - 1]
	if oSum == eSum:
		count += 1
print(count)


def main():
	count = int(input())
	arr = input().split()
	store = [0]
	pole = 1
	for x in range(count):
		arr[x] = int(arr[x])
		store.append(store[-1] + pole * arr[x])
		pole *= -1
	n = 0
	pole = 1
	for x in range(count):
		test = store[x] - (store[-1] - store[x + 1])
		if test == 0:
			n += 1
	print(n)
main()


n = int(input())
a = list(map(int, input().split()))
lol = 0
sum1 = 0
sum2 = 0
for i in range(n):
	if i != 0:
		if i % 2 == 1:
			sum1 += a[i]
		else:
			sum2 += a[i]
if sum1 == sum2:
	lol += 1
for j in range(1, n):
	if j % 2 == 1:
		sum1 -= a[j]
		sum1 += a[j - 1]
	else:
		sum2 -= a[j]
		sum2 += a[j - 1]
	if sum1 == sum2:
		lol += 1
print(lol)


n = int(input())
A = list(map(int, input().split()))
sum_left_odd = [0] * (n + 1)
sum_left_even = [0] * (n + 1)
sum_right_odd = [0] * (n + 1)
sum_right_even = [0] * (n + 1)
for i in range(n):
	if i % 2 == 0:
		sum_left_even[i] = sum_left_even[i - 1] + A[i]
		sum_left_odd[i] = sum_left_odd[i - 1]
	else:
		sum_left_even[i] = sum_left_even[i - 1]
		sum_left_odd[i] = sum_left_odd[i - 1] + A[i]
B = A[::-1]
for i in range(n):
	if i % 2 == 0:
		sum_right_even[i] = sum_right_even[i - 1] + B[i]
		sum_right_odd[i] = sum_right_odd[i - 1]
	else:
		sum_right_even[i] = sum_right_even[i - 1]
		sum_right_odd[i] = sum_right_odd[i - 1] + B[i]
answer = 0
for i in range(n):
	if n % 2:
		answer += int(sum_left_odd[i] + sum_right_even[n - i - 1] == sum_left_even[i] + sum_right_odd[n - i - 1])
	else:
		answer += int(sum_left_odd[i] + sum_right_odd[n - i - 1] == sum_left_even[i] + sum_right_even[n - i - 1])
print(answer)


import copy

def candy_problem():
	n = eval(input())
	input_list = input().split(' ')
	input_list.extend(['0', '0', '0'])
	for (i, _) in enumerate(input_list):
		input_list[i] = int(input_list[i])
	(l2r, r2l) = (copy.deepcopy(input_list), copy.deepcopy(input_list))
	for i in range(n):
		if i >= 2:
			l2r[i] = input_list[i] + l2r[i - 2]
		else:
			l2r[i] = input_list[i]
	for i in range(n - 1, -1, -1):
		r2l[i] = input_list[i] + r2l[i + 2]
	answer = 0
	for i in range(n):
		(a, b) = (0, 0)
		if i >= 2:
			a = l2r[i - 2]
			b = l2r[i - 1]
		elif i == 1:
			b = l2r[0]
		a += r2l[i + 1]
		b += r2l[i + 2]
		if a == b:
			answer += 1
	print(answer)
	return
candy_problem()


n = int(input())
arr = list(map(int, input().split()))
odd_sum = [0]
even_sum = [0]
for (i, val) in enumerate(arr, start=1):
	if i % 2 == 1:
		odd_sum.append(odd_sum[i - 1] + val)
		even_sum.append(even_sum[-1])
	else:
		even_sum.append(even_sum[-1] + val)
		odd_sum.append(odd_sum[-1])
count = 0
for (i, val) in enumerate(arr, start=1):
	pre_odd_sum = odd_sum[i - 1]
	pre_even_sum = even_sum[i - 1]
	post_odd_sum = even_sum[-1] - even_sum[i]
	post_even_sum = odd_sum[-1] - odd_sum[i]
	if pre_odd_sum + post_odd_sum == pre_even_sum + post_even_sum:
		count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
if n == 1:
	print(1)
else:
	left = [0 for i in range(n)]
	right = [0 for i in range(n)]
	left[0] = l[0]
	right[-1] = l[-1]
	left[1] = l[1]
	right[-2] = l[-2]
	for i in range(2, n):
		left[i] = left[i - 2] + l[i]
	for i in range(n - 3, -1, -1):
		right[i] = right[i + 2] + l[i]
	ans = 0
	for i in range(n):
		a = right[i + 1] if i < n - 1 else 0
		b = left[i - 2] if i >= 2 else 0
		lhs = a + b
		a = right[i + 2] if i < n - 2 else 0
		b = left[i - 1] if i >= 1 else 0
		rhs = a + b
		if lhs == rhs:
			ans += 1
	print(ans)


import fileinput
import sys
i = 0
n = int(sys.stdin.readline())
candies = list(map(int, sys.stdin.readline().split()))
odds = [0] * n
evens = [0] * n
outputs = 0
even = 0
odd = 0
for i in range(n):
	if i % 2:
		even += candies[i]
	else:
		odd += candies[i]
	evens[i] = even
	odds[i] = odd
if odds[n - 1] - odds[0] == evens[n - 1] - evens[0]:
	outputs += 1
for i in range(1, n):
	if evens[i - 1] + (odds[n - 1] - odds[i]) == odds[i - 1] + (evens[n - 1] - evens[i]):
		outputs += 1
print(outputs)


n = int(input())
a = list(map(int, input().split()))
s1 = 0
s2 = 0
s3 = 0
s4 = 0
ops = [0] * n
eps = [0] * n
oss = [0] * n
ess = [0] * n
ops[0] = a[0]
oss[0] = 0
for i in range(1, n):
	if i % 2 == 0:
		ops[i] += ops[i - 1] + a[i]
		eps[i] = eps[i - 1]
	else:
		eps[i] += eps[i - 1] + a[i]
		ops[i] = ops[i - 1]
if n % 2 == 0:
	ess[n - 1] = a[n - 1]
else:
	oss[n - 1] = a[n - 1]
for i in range(n - 2, -1, -1):
	if i % 2 == 0:
		oss[i] += oss[i + 1] + a[i]
		ess[i] = ess[i + 1]
	else:
		ess[i] += ess[i + 1] + a[i]
		oss[i] = oss[i + 1]
co = 0
for i in range(n):
	s1 = 0
	s2 = 0
	if i % 2 == 0:
		s1 += ops[i] - a[i] + ess[i]
		s2 += eps[i] + (oss[i] - a[i])
	else:
		s1 += eps[i] - a[i] + oss[i]
		s2 += ops[i] - a[i] + ess[i]
	if s1 == s2:
		co += 1
print(co)


from sys import stdin, stdout
for _ in range(1):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	sufe = [0] * n
	sufo = [0] * n
	if n - 1 & 1:
		sufo[n - 1] = a[n - 1]
	else:
		sufe[n - 1] = a[n - 1]
	for i in range(n - 2, -1, -1):
		if i & 1:
			sufo[i] = a[i] + sufo[i + 1]
			sufe[i] = sufe[i + 1]
		else:
			sufe[i] = a[i] + sufe[i + 1]
			sufo[i] = sufo[i + 1]
	se = so = ans = 0
	for i in range(n):
		if i & 1:
			sm = se + sufo[i] - a[i] - (so + sufe[i])
			if sm == 0:
				ans += 1
			so += a[i]
		else:
			sm = so + sufe[i] - a[i] - (se + sufo[i])
			if sm == 0:
				ans += 1
			se += a[i]
	print(ans)


cin = input
n = int(cin())
a = [int(i) for i in input().split()]
(x, y, d, k, cnt) = (sum(a[0:n:2]), sum(a[1:n:2]), 0, 0, 0)
for i in range(n):
	x -= a[i] * (not i % 2)
	y -= a[i] * (i % 2)
	cnt += d + y == k + x
	d += a[i] * (not i % 2)
	k += a[i] * (i % 2)
print(cnt)


import sys
import math
import collections
import bisect
import string

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(1):
	n = int(input())
	arr = get_list()
	odd_suff = sum(arr[1::2])
	even_suff = sum(arr[2::2])
	ans = 0
	if odd_suff == even_suff:
		ans += 1
	for i in range(1, n):
		if i % 2 == 0:
			even_suff -= arr[i]
			even_suff += arr[i - 1]
		else:
			odd_suff += arr[i - 1]
			odd_suff -= arr[i]
		if even_suff == odd_suff:
			ans += 1
	print(ans)


m = int(input())
l = [int(x) for x in input().split()]
if m == 1:
	print(1)
elif m == 2:
	print(0)
else:
	sum_odd = [l[0]]
	sum_even = [l[1]]
	for _ in range(2, m - 1, 2):
		sum_odd.append(sum_odd[-1] + l[_])
		sum_even.append(sum_even[-1] + l[_ + 1])
	if m % 2 != 0:
		sum_odd.append(sum_odd[-1] + l[-1])
	counter = 0
	if sum_odd[-1] - sum_odd[0] == sum_even[-1]:
		counter += 1
	if sum_even[-1] - sum_even[0] + sum_odd[0] == sum_odd[-1] - sum_odd[0]:
		counter += 1
	if m % 2 == 0:
		for i in range(2, m - 2):
			j = int(i / 2)
			even = sum_even[j - 1] + sum_odd[-1] - sum_odd[j]
			if i % 2 == 1:
				odd = sum_odd[j] + sum_even[-1] - sum_even[j]
			else:
				odd = sum_odd[j - 1] + sum_even[-1] - sum_even[j - 1]
			if odd == even:
				counter += 1
		if sum_odd[-1] == sum_even[-2]:
			counter += 1
		if sum_odd[-2] + l[-1] == sum_even[-2]:
			counter += 1
	else:
		for i in range(2, m - 1):
			j = int(i / 2)
			even = sum_even[j - 1] + sum_odd[-1] - sum_odd[j]
			if i % 2 == 1:
				odd = sum_odd[j] + sum_even[-1] - sum_even[j]
			else:
				odd = sum_odd[j - 1] + sum_even[-1] - sum_even[j - 1]
			if odd == even:
				counter += 1
		if sum_odd[-2] == sum_even[-1]:
			counter += 1
	print(counter)


n = int(input())
a = list(map(int, input().split()))
odd = 0
eve = 0
for i in range(n):
	if i % 2 == 0:
		eve += a[i]
	else:
		odd += a[i]
x = 0
y = 0
ans = 0
for i in range(n):
	if i % 2 == 0:
		eve -= a[i]
		if x + eve == y + odd:
			ans += 1
		y += a[i]
	else:
		odd -= a[i]
		if x + eve == y + odd:
			ans += 1
		x += a[i]
print(ans)


n = int(input())
a = []
a = [int(x) for x in input().split()]
even = []
odd = []
f = 0
count = 0
for i in range(n):
	if i % 2 == 0:
		even.append(a[i])
	else:
		odd.append(a[i])
for i in range(1, len(even)):
	even[i] = even[i] + even[i - 1]
for i in range(1, len(odd)):
	odd[i] = odd[i] + odd[i - 1]
evenl = len(even)
oddl = len(odd)
if n == 1:
	f = 1
	print('1')
elif n % 2 == 0:
	x = even[evenl - 1] - a[0]
	y = odd[oddl - 1] - a[n - 1]
	if x == odd[oddl - 1]:
		count += 1
	if y == int(even[evenl - 1]):
		count += 1
else:
	x = even[evenl - 1] - a[0]
	y = even[evenl - 1] - a[n - 1]
	if x == odd[oddl - 1]:
		count += 1
	if y == odd[oddl - 1]:
		count += 1
j = 0
for i in range(1, n - 1):
	if i % 2 != 0:
		x = even[j] + odd[oddl - 1] - odd[j]
		y = odd[j] + even[evenl - 1] - even[j]
	y = odd[j] + even[evenl - 1] - even[j] - a[i]
	if x == y:
		count += 1
	if i % 2 == 0:
		j += 1
if f == 0:
	print(count)


n = int(input())
a = [int(x) for x in input().split()]
sum_odd = 0
sum_even = 0
cnt = 0
for x in range(n):
	if (x + 1) % 2 == 1:
		sum_odd = sum_odd + a[x]
	else:
		sum_even = sum_even + a[x]
odd = 0
even = 0
for x in range(n - 1, -1, -1):
	temp_odd = sum_odd
	temp_even = sum_even
	if (x + 1) % 2 == 1:
		odd = odd + a[x]
		temp_odd = temp_odd - odd + even
		temp_even = temp_even - even + (odd - a[x])
	else:
		even = even + a[x]
		temp_even = temp_even - even + odd
		temp_odd = temp_odd - odd + (even - a[x])
	if temp_even == temp_odd:
		cnt = cnt + 1
print(cnt)


def mi():
	return list(map(int, input().split()))
n = int(input())
a = list(mi())
od = 0
ev = 0
for i in range(n):
	if i % 2:
		od += a[i]
	else:
		ev += a[i]
cnt = 0
(rod, rev) = (0, 0)
for i in range(n - 1, -1, -1):
	if i % 2 == 0:
		ev -= a[i]
	else:
		od -= a[i]
	if ev + rev == od + rod:
		cnt += 1
	if i % 2 == 0:
		rod += a[i]
	else:
		rev += a[i]
print(cnt)


a = int(input())
z = list(map(int, input().split()))
if a == 1:
	print(1)
	exit()
odd = []
eve = []
for i in range(len(z)):
	if i % 2 == 0:
		odd.append(z[i])
	else:
		eve.append(z[i])
pre1 = [odd[0]]
for i in range(1, len(odd)):
	pre1.append(pre1[-1] + odd[i])
for i in range(len(pre1)):
	pre1[i] -= z[2 * i]
pre2 = [eve[0]]
for i in range(1, len(eve)):
	pre2.append(pre2[-1] + eve[i])
for i in range(len(eve)):
	pre2[i] -= z[2 * i + 1]
c1 = 0
suf1 = [sum(z[0::2])]
suf2 = [sum(z[1::2])]
for i in range(1, len(odd)):
	suf1.append(suf1[-1] - z[2 * (i - 1)])
for i in range(1, len(eve)):
	suf2.append(suf2[-1] - z[2 * i - 1])
for j in range(len(z)):
	if j % 2 == 0:
		m = j // 2
		if m >= len(suf2) or m >= len(pre2):
			continue
		if pre1[m] + suf2[m] == pre2[m] + suf1[m] - z[j]:
			c1 += 1
	else:
		m = j // 2
		if pre1[m] + z[j - 1] + suf2[m] - z[j] == pre2[m] + suf1[m] - z[j - 1]:
			c1 += 1
if len(z) % 2 == 1:
	if sum(z[0::2]) - z[-1] == sum(z[1::2]):
		c1 += 1
print(c1)


n = int(input())
if n == 1:
	print(1)
	exit(0)
cnt = 0
CANDY = list(map(int, input().split()))
even_pr = CANDY[0:n:2]
odd_pr = CANDY[1:n:2]
for i in range(1, len(even_pr)):
	even_pr[i] += even_pr[i - 1]
for j in range(1, len(odd_pr)):
	odd_pr[j] += odd_pr[j - 1]
for i in range(1, n):
	if even_pr[(i - 1) // 2] + odd_pr[-1] - odd_pr[(i - 1) // 2] == (even_pr[-1] + odd_pr[-1] - CANDY[i]) / 2:
		cnt += 1
if odd_pr[-1] == even_pr[-1] - even_pr[0]:
	cnt += 1
print(cnt)


from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')

def solve():
	n = ii()
	a = li()
	e = [0] * n
	o = [0] * n
	e[0] = a[0]
	for i in range(1, n):
		e[i] = e[i - 1]
		o[i] = o[i - 1]
		if i & 1:
			o[i] += a[i]
		else:
			e[i] += a[i]
	ans = 0
	(s1, s2) = (0, 0)
	for i in range(n):
		x1 = e[n - 1] - e[i]
		x2 = o[n - 1] - o[i]
		if s1 + x1 == s2 + x2:
			ans += 1
		if i & 1:
			s1 += a[i]
		else:
			s2 += a[i]
	print(ans)
solve()


n = int(input())
ls = list(map(int, input().split()))
even = [0] * (n + 1)
odd = [None] * (n + 1)
even[0] = 0
odd[0] = 0
for i in range(0, n):
	k = i + 1
	even[k] = even[k - 1]
	odd[k] = odd[k - 1]
	if k % 2 == 0:
		even[k] += ls[i]
	else:
		odd[k] += ls[i]
ans = 0
for i in range(0, n):
	k = i + 1
	even1 = 0
	odd1 = 0
	odd1 += odd[k - 1]
	even1 += even[k - 1]
	odd1 += even[n] - even[k]
	even1 += odd[n] - odd[k]
	if odd1 == even1:
		ans += 1
print(ans)


n = int(input())
A = list(map(int, input().split()))
E = [0] * (n + 1)
O = [0] * (n + 1)
for i in range(n):
	E[i + 1] = E[i]
	O[i + 1] = O[i]
	if i % 2 == 0:
		E[i + 1] += A[i]
	else:
		O[i + 1] += A[i]
ans = 0
for i in range(n):
	e = E[n] - E[i + 1] + O[i] - O[0]
	o = O[n] - O[i + 1] + E[i] - E[0]
	if o == e:
		ans += 1
print(ans)


def getIntList(lst):
	assert type(lst) is list or type(lst) is str
	if type(lst) == str:
		lst = lst.split(' ')
	rep = []
	for i in lst:
		rep.append(int(i))
	return rep
n = int(input())
a = getIntList(input())
(a1, b1, a2, b2) = (0, 0, 0, 0)
ans = 0
for i in range(0, len(a)):
	if i % 2 == 0:
		a2 += a[i]
	else:
		b2 += a[i]
for i in range(0, len(a)):
	cur = a[i]
	if i % 2 == 0:
		a2 -= cur
		if a1 + b2 == a2 + b1:
			ans += 1
		a1 += cur
	else:
		b2 -= cur
		if a1 + b2 == a2 + b1:
			ans += 1
		b1 += cur
print(ans)


n = int(input())
a = map(int, input().split())
(e, o) = ([0], [0])
for (i, v) in enumerate(a):
	if i % 2:
		e.append(e[-1] + v)
		o.append(o[-1])
	else:
		e.append(e[-1])
		o.append(o[-1] + v)
r = 0
for i in range(1, n + 1):
	if e[i - 1] + o[-1] - o[i] == o[i - 1] + e[-1] - e[i]:
		r += 1
print(r)


n = int(input())
a = list(map(int, input().split()))
S_odd = [0]
S_even = [0]
S = sum(a)
for i in range(n):
	if i % 2 == 0:
		S_odd.append(S_odd[-1] + a[i])
	else:
		S_even.append(S_even[-1] + a[i])
odd_last = S_odd[-1]
even_last = S_even[-1]
ans = 0
if n % 2:
	for i in range(1, n // 2 + 1):
		if S_odd[i] + even_last - S_even[i] == S_even[i - 1] + odd_last - S_odd[i]:
			ans += 1
		if S_odd[i - 1] + even_last - S_even[i - 1] == S_even[i - 1] + odd_last - S_odd[i]:
			ans += 1
	if S_odd[-2] == S_even[-1]:
		ans += 1
else:
	for i in range(1, n // 2 + 1):
		if S_odd[i] + even_last - S_even[i] == S_even[i - 1] + odd_last - S_odd[i]:
			ans += 1
		if S_odd[i - 1] + even_last - S_even[i - 1] == S_even[i - 1] + odd_last - S_odd[i]:
			ans += 1
print(ans)


n = int(input())
a = input().split()
a = [int(i) for i in a]
odd = []
even = []
s1 = 0
s2 = 0
for i in range(n):
	if i % 2 == 0:
		s1 += a[i]
		odd.append(s1)
		even.append(s2)
	else:
		s2 += a[i]
		odd.append(s1)
		even.append(s2)
ans = 0
for i in range(n):
	if i % 2 == 0:
		if odd[i] - a[i] + even[n - 1] - even[i] == even[i] + odd[n - 1] - odd[i]:
			ans += 1
	elif even[i] - a[i] + odd[n - 1] - odd[i] == odd[i] + even[n - 1] - even[i]:
		ans += 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
(x, y) = (0, 0)
for i in range(1, n):
	if i % 2 == 0:
		x += l[i]
	else:
		y += l[i]
c = 0
if x == y:
	c = c + 1
for i in range(1, n):
	if i % 2 == 0:
		x -= l[i]
		x += l[i - 1]
		if x == y:
			c = c + 1
	else:
		y = y - l[i]
		y += l[i - 1]
		if y == x:
			c = c + 1
print(c)


n = int(input())
l = list(map(int, input().split()))
s1 = 0
s2 = 0
for i in range(1, n, 2):
	s1 += l[i]
for i in range(2, n, 2):
	s2 += l[i]
count = 0
if s1 == s2:
	count += 1
for i in range(1, n):
	if i % 2:
		s1 -= l[i]
		s1 += l[i - 1]
	else:
		s2 -= l[i]
		s2 += l[i - 1]
	if s1 == s2:
		count += 1
print(count)


n = int(input())
if n == 1:
	print(1)
	exit()
elif n == 2:
	print(0)
	exit()
a = list(map(int, input().split()))
(L, R) = ([0] * n, [0] * n)
L[:2] = a[:2]
for i in range(2, n):
	L[i] = L[i - 2] + a[i]
R[-2:] = a[-2:]
for i in range(n - 3, -1, -1):
	R[i] = R[i + 2] + a[i]
ans = 0
if R[1] == R[2]:
	ans += 1
if L[-3] == L[-2]:
	ans += 1
for i in range(1, n - 1):
	u1 = L[i - 1]
	v1 = L[i - 2] if i - 2 >= 0 else 0
	v2 = R[i + 1]
	u2 = R[i + 2] if i + 2 < n else 0
	if u1 + u2 == v1 + v2:
		ans += 1
print(ans)


n = int(input())
arr = list(map(int, input().split()))
goods = 0
sum1 = 0
sum2 = 0
ost1 = 0
ost2 = 0
for i in range(0, n, 2):
	ost1 += arr[i]
for i in range(1, n, 2):
	ost2 += arr[i]
for i in range(n):
	if i % 2 == 0:
		ost1 -= arr[i]
		if sum1 + ost2 == sum2 + ost1:
			goods += 1
		sum1 += arr[i]
	elif i % 2 == 1:
		ost2 -= arr[i]
		if sum2 + ost1 == sum1 + ost2:
			goods += 1
		sum2 += arr[i]
print(goods)


n = int(input())
a = list(map(int, input().split()))
c = [0]
nc = [0]
fnc = sum(a[::2])
fc = sum(a[1::2])
chet = False
for s in a:
	if chet:
		c.append(c[-1] + s)
		nc.append(nc[-1])
	else:
		nc.append(nc[-1] + s)
		c.append(c[-1])
	chet = not chet
good = 0
for i in range(1, n + 1):
	sum_chet = c[i - 1] + fnc - nc[i]
	sum_nc = nc[i - 1] + fc - c[i]
	if sum_chet == sum_nc:
		good += 1
print(good)


n = int(input())
L = [int(i) for i in input().split()]
e = 0
d = 0
for i in range(n):
	if (i + 1) % 2 == 0:
		e += L[i]
	else:
		d += L[i]
s = 0
e1 = 0
d1 = 0
for i in range(n - 1, -1, -1):
	if (i + 1) % 2 == 0:
		e = e - L[i]
		if e + e1 == d + d1:
			s += 1
		d1 += L[i]
	else:
		d = d - L[i]
		if e + e1 == d + d1:
			s += 1
		e1 += L[i]
print(s)


N = int(input())
l = list(map(int, input().split()))
l1 = l[1::2]
l2 = l[2::2]
s = sum(l1)
t = sum(l2)
ans = 0
if s == t:
	ans += 1
for i in range(1, N):
	if i % 2 == 1:
		s += l[i - 1] - l[i]
	else:
		t += l[i - 1] - l[i]
	if s == t:
		ans += 1
print(ans)


n = int(input())
s = [int(x) for x in input().split()]
if n == 1:
	print(1)
elif n == 2:
	print(0)
else:
	dp = [s[0], s[1]]
	for i in range(2, len(s)):
		dp.append(s[i] + dp[i - 2])
	if n % 2 == 0:
		sume = dp[-1]
		sumo = dp[-2]
	else:
		sume = dp[-2]
		sumo = dp[-1]
	dp = [0] + dp
	ct = 0
	for i in range(1, len(dp)):
		if i % 2 == 0:
			t1 = dp[i - 1] + sume - dp[i]
			t2 = dp[i] + sumo - dp[i - 1] - s[i - 1]
		else:
			t1 = dp[i - 1] + sumo - dp[i]
			t2 = dp[i] + sume - dp[i - 1] - s[i - 1]
		if t1 == t2:
			ct = ct + 1
	print(ct)


n = int(input())
ln = [int(a) for a in input().split(' ')]
(before_evens, before_odds) = (0, 0)
after_evens = 0
for i in range(n):
	if i % 2 == 1:
		after_evens += ln[i]
after_odds = sum(ln) - after_evens - ln[0]
ans = 0
for i in range(1, n + 1):
	overall_evens = before_evens + after_odds
	overall_odds = before_odds + after_evens
	if overall_evens == overall_odds:
		ans += 1
	if i % 2 == 0:
		before_evens += ln[i - 1]
		if i < n:
			after_odds -= ln[i]
	else:
		before_odds += ln[i - 1]
		if i < n:
			after_evens -= ln[i]
print(ans)


fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from re import *
from sys import *
from math import *
from heapq import *
from queue import *
from bisect import *
from string import *
from itertools import *
from collections import *
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from collections import Counter as cc
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = 1
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)

def output(answer):
	stdout.write(str(answer))
num = int(z())
arr = zzz()
ans = 0
even = sum(arr[2::2])
odd = sum(arr[1::2])
if even == odd:
	ans += 1
for i in range(1, num):
	if i % 2 == 0:
		even -= arr[i]
		even += arr[i - 1]
	else:
		odd += arr[i - 1]
		odd -= arr[i]
	if even == odd:
		ans += 1
print(ans)


n = int(input())
L = list(map(int, input().split()))
(l, r) = (0, 0)
(l1, r1) = (0, 0)
k = 0
for i in range(n):
	if i % 2 == 0:
		l += L[i]
	else:
		r += L[i]
for i in range(n):
	if i % 2 == 0:
		l -= L[i]
		if l + r1 == r + l1:
			k += 1
		l1 += L[i]
	else:
		r -= L[i]
		if l + r1 == r + l1:
			k += 1
		r1 += L[i]
print(k)


(N, vals) = (int(input()), list(map(int, input().split())))
(odds, evens) = (0, 0)
for i in range(N):
	if i % 2 == 0:
		odds += vals[i]
	else:
		evens += vals[i]
(odds, evens, num_good) = (evens, odds - vals[0], 0)
if odds == evens:
	num_good += 1
for i in range(1, N):
	if i % 2 == 1:
		odds = odds - vals[i] + vals[i - 1]
	else:
		evens = evens - vals[i] + vals[i - 1]
	if odds == evens:
		num_good += 1
print(num_good)


import math
import os
import random
import re
import sys

def solve(digits):
	n = len(digits)
	if n == 1:
		return 1
	if n == 2:
		return 0
	even_now = 0
	even_prefix = []
	odd_now = 0
	odd_prefix = []
	for i in range(n):
		if i % 2 != 0:
			even_now += digits[i]
		else:
			odd_now += digits[i]
		even_prefix.append(even_now)
		odd_prefix.append(odd_now)
	total = 0
	for i in range(n):
		even_prefix_to_i = even_prefix[i - 1] if i > 0 else 0
		summ_even = even_prefix_to_i + odd_now - odd_prefix[i]
		odd_prefix_to_i = odd_prefix[i - 1] if i > 0 else 0
		summ_odd = odd_prefix_to_i + even_now - even_prefix[i]
		if summ_even == summ_odd:
			total += 1
	return total
input()
digits = list(map(int, input().strip().split()))
print(solve(digits))


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

def li():
	return list(map(int, input().split()))

def num():
	return map(int, input().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def solve():
	t = 1
	for it in range(t):
		n = nu()
		a = li()
		x = []
		y = [0]
		x.append(a[0])
		for i in range(1, n):
			if i % 2 == 0:
				x.append(a[i])
				y.append(0)
			else:
				y.append(a[i])
				x.append(0)
		for i in range(1, n):
			x[i] = x[i - 1] + x[i]
			y[i] = y[i - 1] + y[i]
		cc = 0
		for i in range(n):
			if i == 0:
				hh = x[n - 1] - a[0]
				yy = y[n - 1]
				if hh == yy:
					cc += 1
			elif i % 2 == 0:
				n1 = x[i - 1]
				n2 = y[i - 1]
				hh = y[n - 1] - y[i]
				yy = x[n - 1] - x[i]
				if n1 + hh == n2 + yy:
					cc += 1
			else:
				n1 = x[i - 1]
				n2 = y[i - 1]
				hh = y[n - 1] - y[i]
				yy = x[n - 1] - x[i]
				if n1 + hh == n2 + yy:
					cc += 1
		print(cc)
solve()


n = int(input())
arr = list(map(int, input().split()))
arr = [0] + arr
(odd, even) = ([0] * (n + 1), [0] * (n + 1))
for i in range(1, n + 1):
	if i % 2 == 1:
		odd[i] = odd[i - 1] + arr[i]
		even[i] = even[i - 1]
	else:
		even[i] = even[i - 1] + arr[i]
		odd[i] = odd[i - 1]
(cnt, odd1, even1) = (0, 0, 0)
for i in range(1, n + 1):
	if i % 2 == 1:
		odd1 = even[n] - even[i] + odd[i] - arr[i]
		even1 = even[i - 1] + odd[n] - odd[i]
		if even1 == odd1:
			cnt += 1
	else:
		odd1 = even[n] - even[i] + odd[i - 1]
		even1 = even[i] + odd[n] - odd[i] - arr[i]
		if even1 == odd1:
			cnt += 1
print(cnt)


n = int(input())
arr = list(map(int, input().split(' ')))
dic = {0: 0, 1: 0}
for (i, elem) in enumerate(arr):
	dic[i % 2] += elem
count = 0
new_dic = {0: 0, 1: 0}
for (i, elem) in enumerate(arr):
	dic[i % 2] -= elem
	if dic[i % 2] + new_dic[(i + 1) % 2] == dic[(i + 1) % 2] + new_dic[i % 2]:
		count += 1
	new_dic[i % 2] += elem
print(count)


input()
a = [*map(int, input().split())]
s = [sum(a[::2]), sum(a[1::2])]
cnt = i = 0
a = [0] + a
for j in range(1, len(a)):
	s[i] += a[j - 1] - a[j]
	if s[0] == s[1]:
		cnt += 1
	i = not i
print(cnt)


n = int(input())
l = list(map(int, input().split()))
count = 0
pso = 0
pse = 0
tso = 0
tse = 0
for i in range(n):
	if i % 2 == 0:
		tse += l[i]
	else:
		tso += l[i]
for i in range(n):
	if i % 2 == 0:
		tse -= l[i]
	else:
		tso -= l[i]
	count += 1 if pse + tso == pso + tse else 0
	if i % 2 == 0:
		pse += l[i]
	else:
		pso += l[i]
print(count)


n = int(input())
tmp = input().split()
candies = []
for i in tmp:
	candies.append(int(i))
sums = {}
sum_even = 0
sum_odd = 0
for i in range(n):
	if i % 2 == 0:
		sum_even += candies[i]
	else:
		sum_odd += candies[i]
	sums[i] = [sum_odd, sum_even]
sums[-1] = [0, 0]
ans = 0
for i in range(0, n):
	if sums[i - 1][0] + sums[n - 1][1] - sums[i][1] == sums[i - 1][1] + sums[n - 1][0] - sums[i][0]:
		ans += 1
print(ans)


n = int(input())
a = [int(i) for i in input().strip().split()]
prevOdd = 0
prevEven = 0
nextOdd = sum(a[0::2])
nextEven = sum(a[1::2])
flag = True
count = 0
for (i, num) in enumerate(a):
	temp = num
	if flag:
		nextOdd -= num
	else:
		nextEven -= num
	if nextOdd + prevEven == nextEven + prevOdd:
		count += 1
	if flag:
		prevOdd += num
		flag = False
	else:
		prevEven += num
		flag = True
print(count)


import math
n = int(input())
arr = list(map(int, input().split()))
(eve, odd) = (0, 0)
for i in range(n):
	if i % 2 == 0:
		eve += arr[i]
	else:
		odd += arr[i]
count = 0
eve -= arr[0]
if eve == odd:
	count += 1
for i in range(1, n):
	if i % 2 == 0:
		eve -= arr[i]
		eve += arr[i - 1]
		if eve == odd:
			count += 1
	else:
		odd -= arr[i]
		odd += arr[i - 1]
		if eve == odd:
			count += 1
print(count)


n = int(input())
a = [int(i) for i in input().split()]
a.insert(0, 0)
oddPref = 0
evenPref = 0
oddSuf = sum(a[1::2])
evenSuf = sum(a[0::2])
count = 0
for i in range(1, n + 1):
	if not i % 2:
		evenSuf = evenSuf - a[i]
	else:
		oddSuf = oddSuf - a[i]
	if oddPref + evenSuf == evenPref + oddSuf:
		count += 1
	if not i % 2:
		evenPref = evenPref + a[i]
	else:
		oddPref = oddPref + a[i]
print(count)


n = int(input())
a = list(map(int, input().split()))
a = [0] + a
ch = [0, 0]
nech = [0, a[1]]
for i in range(2, n + 1):
	if i % 2 == 0:
		ch.append(ch[i - 2] + a[i])
		nech.append(nech[-1])
	else:
		nech.append(nech[i - 2] + a[i])
		ch.append(ch[-1])
ans = 0
for i in range(1, n + 1):
	s1 = nech[i - 1]
	s2 = ch[i - 1]
	s1 += ch[n] - ch[i]
	s2 += nech[n] - nech[i]
	if s1 == s2:
		ans += 1
print(ans)


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, sin, cos, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(1000000000)
INF = float('inf')
(YES, Yes, yes, NO, No, no) = ('YES', 'Yes', 'yes', 'NO', 'No', 'no')
(dy4, dx4) = ([0, 1, 0, -1], [1, 0, -1, 0])
(dy8, dx8) = ([0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1])

def inside(y, x, H, W):
	return 0 <= y < H and 0 <= x < W

def ceil(a, b):
	return (a + b - 1) // b

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	g = gcd(a, b)
	return a / g * b

def euclidean_distance(y1, x1, y2, x2):
	return sqrt((y1 - y2) ** 2 + (x1 - x2) ** 2)

def manhattan_distance(y1, x1, y2, x2):
	return abs(y1 - y2) + abs(x1 - x2)

def main():
	N = int(input())
	C = list(map(int, input().split()))
	(even, odd) = ([0] * (N + 1), [0] * (N + 1))
	for (i, c) in enumerate(C):
		if i % 2 == 0:
			even[i + 1] = even[i] + c
			odd[i + 1] = odd[i]
		else:
			even[i + 1] = even[i]
			odd[i + 1] = odd[i] + c
	ans = 0
	for (i, c) in enumerate(C):
		e = even[i] + (odd[N] - odd[i + 1])
		o = odd[i] + (even[N] - even[i + 1])
		ans += e == o
	print(ans)
main()


n = int(input())
a = [int(i) for i in input().split()]
s = sum(a)
b1 = []
(s1, s2) = (0, 0)
for i in range(n):
	b1.append([s1, s2])
	if i % 2 == 0:
		s1 += a[i]
	else:
		s2 += a[i]
b2 = []
(s1, s2) = (0, 0)
for i in range(n - 1, -1, -1):
	b2.append([s1, s2])
	if i % 2 == 0:
		s1 += a[i]
	else:
		s2 += a[i]
b2.reverse()
r = 0
for i in range(n):
	if b1[i][0] + b2[i][1] == b1[i][1] + b2[i][0]:
		r += 1
print(r)


from functools import *
n = int(input())
a = [0] + [i for i in map(int, input().split())]
ctr = i = 0
s = [sum(a[1::2]), sum(a[2::2])]
for j in range(0, len(a) - 1):
	s[i] += a[j] - a[j + 1]
	if s[0] == s[1]:
		ctr += 1
	i = not i
print(ctr)


n = int(input())
lis = list(map(int, input().split()))
if (n - 1) % 2 == 0:
	even = [0, lis[-1]]
	odd = [0, 0]
else:
	odd = [0, lis[-1]]
	even = [0, 0]
for i in range(n - 2, -1, -1):
	if i % 2 == 0:
		even.append(lis[i] + even[-1])
		odd.append(odd[-1])
	else:
		odd.append(lis[i] + odd[-1])
		even.append(even[-1])
cnt = 0
odd.reverse()
even.reverse()
for i in range(n):
	teven = odd[i + 1] + (even[0] - even[i])
	todd = even[i + 1] + (odd[0] - odd[i])
	if teven == todd:
		cnt += 1
print(cnt)


__author__ = 'Esfandiar'
__attention__ = 'This code written by analysing cs1g code'
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
(a1, b1) = (sum(a[1::2]), sum(a[2::2]))
res = int(a1 == b1)
for i in range(n - 1):
	yy = a[i] - a[i + 1]
	if i % 2 == 0:
		a1 += yy
	else:
		b1 += yy
	res += a1 == b1
print(res)


import os
from io import BytesIO, StringIO

def input_as_list():
	return list(map(int, input().split()))

def array_of(f, *dim):
	return [array_of(f, *dim[1:]) for _ in range(dim[0])] if dim else f()

def main():
	n = int(input())
	a = input_as_list()
	(s0, s1) = ([0], [0])
	for i in range(n):
		if i % 2 == 0:
			s0.append(s0[-1] + a[i])
			s1.append(s1[-1])
		else:
			s0.append(s0[-1])
			s1.append(s1[-1] + a[i])

	def f(s, i, j):
		return s[j] - s[i]
	out = 0
	for i in range(n):
		if f(s0, 0, i) + f(s1, i + 1, n) == f(s1, 0, i) + f(s0, i + 1, n):
			out += 1
	print(out)
main()


n = int(input())
a = list(map(int, input().split(' ')))
od = {0: 0}
ev = {0: 0}
for i in range(n):
	if i % 2 == 0:
		od[i + 1] = od[i] + a[i]
		ev[i + 1] = ev[i]
	else:
		ev[i + 1] = ev[i] + a[i]
		od[i + 1] = od[i]
count = 0
for i in range(1, n + 1):
	if od[i - 1] + ev[n] - ev[i] == ev[i - 1] + od[n] - od[i]:
		count += 1
print(count)


n = int(input())
cl = list(map(int, input().split()))
sm1 = 0
sm2 = 0
l1 = []
l2 = []
for i in range(n):
	if i % 2 == 0:
		sm1 += cl[i]
	else:
		sm2 += cl[i]
l1.append(sm1)
l2.append(sm2)
s1 = 0
s2 = 0
res = 0
for i in range(n):
	if i % 2 == 0:
		if s1 + sm2 - s2 == s2 + sm1 - s1 - cl[i]:
			res += 1
		s1 += cl[i]
	else:
		if s1 + sm2 - s2 - cl[i] == s2 + sm1 - s1:
			res += 1
		s2 += cl[i]
print(res)


n = int(input())
a = list(map(int, input().split()))
odd = 0
even = 0
o = []
e = []
for i in range(n):
	if (i + 1) % 2 == 0:
		even += a[i]
	else:
		odd += a[i]
x = odd
y = even
for i in range(n):
	if (i + 1) % 2 != 0:
		odd -= a[i]
		o.append(odd)
		e.append(even)
	else:
		even -= a[i]
		e.append(even)
		o.append(odd)
ans = 0
for i in range(n):
	if (i + 1) % 2 == 0:
		s = y - e[i] - a[i]
		d = x - o[i]
		a1 = s + o[i]
		a2 = d + e[i]
		if a1 == a2:
			ans += 1
	else:
		s = y - e[i]
		d = x - o[i] - a[i]
		a1 = s + o[i]
		a2 = d + e[i]
		if a1 == a2:
			ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
sa = [[0, 0] for i in range(n + 1)]
for i in range(n):
	x = i + 1
	sa[x][x & 1] += a[i]
for i in range(1, n + 1):
	sa[i][0] += sa[i - 1][0]
	sa[i][1] += sa[i - 1][1]
count = 0
(sme, smo) = sa[n]
for i in range(1, n + 1):
	if sa[i - 1][0] + smo - sa[i][1] == sa[i - 1][1] + sme - sa[i][0]:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
odd1 = 0
odd2 = 0
even1 = 0
even2 = 0
ans = 0
for i in range(len(a)):
	if i % 2 == 1:
		even1 += a[i]
	else:
		odd1 += a[i]
for i in range(n):
	if i % 2 == 0:
		odd1 -= a[i]
	else:
		even1 -= a[i]
	if even1 + odd2 == even2 + odd1:
		ans += 1
	if i % 2 == 0:
		odd2 += a[i]
	else:
		even2 += a[i]
print(ans)


n = int(input())
a = list(map(int, input().split()))
pre1 = [a[0]]
pre2 = [0]
for i in range(1, n):
	if i % 2 == 0:
		pre1.append(a[i] + pre1[i - 1])
	else:
		pre1.append(pre1[i - 1])
for i in range(1, n):
	if i % 2 == 0:
		pre2.append(pre2[i - 1])
	else:
		pre2.append(a[i] + pre2[i - 1])
count = 0
for i in range(n):
	if i == 0 and pre1[n - 1] - pre1[0] == pre2[n - 1] - pre2[0]:
		count += 1
	elif i == n:
		if pre1[n - 1] == pre2[n - 1]:
			count += 1
	elif pre1[i - 1] + (pre2[n - 1] - pre2[i]) == pre2[i - 1] + (pre1[n - 1] - pre1[i]):
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
even = [0] * n
odd = [0] * n
if n == 1:
	print(1)
	exit()
elif n == 2:
	print(0)
	exit()
even[0] = a[0]
odd[1] = a[1]
for i in range(2, n):
	if i % 2 == 0:
		even[i] = even[i - 2] + a[i]
	else:
		odd[i] = odd[i - 2] + a[i]
num = 0
totaleven = max(even)
totalodd = max(odd)
for i in range(n):
	if n == 0:
		p = totaleven - even[0]
		q = totalodd
		if p == q:
			num += 1
	elif i % 2 == 0:
		p = even[i - 2] + totalodd - odd[i - 1]
		q = odd[i - 1] + totaleven - even[i]
		if p == q:
			num += 1
	elif i % 2 != 0:
		p = even[i - 1] + totalodd - odd[i]
		o = 0
		if i != 1:
			o = odd[i - 2]
		q = o + totaleven - even[i - 1]
		if p == q:
			num += 1
print(num)


R = lambda : map(int, input().split())
n = int(input())
L = list(R())
pre = []
suf = []
(l, r) = (0, 0)
for i in range(n):
	if i % 2:
		pre.append((l, r))
		r += L[i]
	else:
		pre.append((l, r))
		l += L[i]
res = 0
(l, r) = (0, 0)
for i in reversed(range(n)):
	if i % 2:
		res += l + pre[i][0] == r + pre[i][1]
		l += L[i]
	else:
		res += l + pre[i][0] == r + pre[i][1]
		r += L[i]
print(res)


n = int(input())
arr = [int(x) for x in input().split()]
feven = 0
fodd = 0
for i in range(n):
	if i % 2 != 0:
		feven += arr[i]
	else:
		fodd += arr[i]
ans = 0
beven = 0
bodd = 0
for i in range(n):
	if i % 2 != 0:
		x = beven + fodd - bodd
		y = bodd + feven - arr[i] - beven
	else:
		x = beven + fodd - arr[i] - bodd
		y = bodd + feven - beven
	if x == y:
		ans += 1
	if i % 2 != 0:
		beven += arr[i]
	else:
		bodd += arr[i]
print(ans)


n = int(input())
l = list(map(int, input().split()))
l.insert(0, 0)
odd = [0] * (n + 1)
even = [0] * (n + 1)
for i in range(1, n + 1):
	odd[i] = odd[i - 1]
	even[i] = even[i - 1]
	if i % 2 == 1:
		odd[i] += l[i]
	else:
		even[i] += l[i]
c = 0
for i in range(1, n + 1):
	odd_val = even[n] - even[i] + odd[i - 1]
	even_val = odd[n] - odd[i] + even[i - 1]
	if odd_val == even_val:
		c += 1
print(c)


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
l = [[0, 0] for _ in range(n + 2)]
r = [[0, 0] for _ in range(n + 2)]
c = 0
for i in range(n):
	l[i + 1][c] = l[i][c] + a[i]
	c ^= 1
	l[i + 1][c] = l[i][c]
c = n % 2
for i in range(n - 1, -1, -1):
	r[i + 1][c] = r[i + 2][c] + a[i]
	c ^= 1
	r[i + 1][c] = r[i + 2][c]
ans = 0
for i in range(n):
	if not l[i][0] + r[i + 2][0] ^ l[i][1] + r[i + 2][1]:
		ans += 1
print(ans)


n = int(input())
A = list(map(int, input().split()))
c = 0
e1 = 0
o1 = 0
e2 = 0
o2 = 0
for j in range(0, n):
	if j % 2 == 0:
		o1 += A[j]
	else:
		e1 += A[j]
for i in range(0, n):
	if i % 2 == 0:
		o1 -= A[i]
	else:
		e1 -= A[i]
	if e2 + o1 == o2 + e1:
		c += 1
	if i % 2 == 0:
		o2 += A[i]
	else:
		e2 += A[i]
print(c)


n = int(input())
arr = list(map(int, input().split()))
counta = [0]
a = 0
countb = [0]
b = 0
i = 1
while i < n + 1:
	if i % 2 == 0:
		a += arr[i - 1]
	else:
		b += arr[i - 1]
	counta.append(a)
	countb.append(b)
	i += 1
ans = 0
a = counta[-1]
b = countb[-1]
for i in range(1, n + 1):
	if i % 2 == 0:
		if counta[i - 1] + b - countb[i - 1] == countb[i - 1] + a - counta[i - 1] - arr[i - 1]:
			ans += 1
	elif counta[i - 1] + b - countb[i - 1] - arr[i - 1] == countb[i - 1] + a - counta[i - 1]:
		ans += 1
print(ans)


n = int(input())
lst = [int(i) for i in input().split()]
result = 0
(even, odd) = (sum(lst[1::2]), sum(lst[2::2]))
for idx in range(n):
	if even == odd:
		result += 1
	if idx == n - 1:
		break
	if idx % 2 == 0:
		even += lst[idx]
		even -= lst[idx + 1]
	else:
		odd += lst[idx]
		odd -= lst[idx + 1]
print(result)


n = int(input())
a = list(map(int, input().split()))
sum_of_all_elements = sum(a)
tot_even_sum = tot_odd_sum = 0
for i in range(0, n):
	if i % 2 == 0:
		tot_even_sum += a[i]
	else:
		tot_odd_sum += a[i]
cur_odd_sum = cur_even_sum = 0
r = 0
for i in range(n):
	if i % 2 == 0:
		if cur_odd_sum + tot_even_sum - cur_even_sum - a[i] == cur_even_sum + tot_odd_sum - cur_odd_sum:
			r += 1
		cur_even_sum += a[i]
	else:
		if cur_odd_sum + tot_even_sum - cur_even_sum == cur_even_sum + tot_odd_sum - cur_odd_sum - a[i]:
			r += 1
		cur_odd_sum += a[i]
print(r)


n = int(input())
a = list(map(int, input().split()))
sum1 = 0
sum2 = 0
for i in range(0, n, 2):
	sum1 += a[i]
for i in range(1, n, 2):
	sum2 += a[i]
cnt = 0
sum11 = 0
sum22 = 0
for i in range(n):
	if i % 2 == 0:
		sum1 -= a[i]
		if sum11 + sum2 == sum22 + sum1:
			cnt += 1
		sum11 += a[i]
	else:
		sum2 -= a[i]
		if sum11 + sum2 == sum22 + sum1:
			cnt += 1
		sum22 += a[i]
print(cnt)


def count_candy(lst, x):
	output = 0
	sum_odd = 0
	sum_even = 0
	for i in range(x):
		if i == 0 or i % 2 == 0:
			sum_even += lst[i]
		elif i % 2 != 0:
			sum_odd += lst[i]
	g = 0
	for i in range(len(lst)):
		if i != 0 and lst[i] == lst[i - 1] and (g == 2):
			output += 1
			continue
		elif i != 0 and lst[i] == lst[i - 1] and (g == 1):
			continue
		if i == 0:
			sum_even -= lst[i]
		elif i % 2 != 0:
			sum_odd -= lst[i]
			sum_odd += lst[i - 1]
		elif i % 2 == 0:
			sum_even -= lst[i]
			sum_even += lst[i - 1]
		if sum_even == sum_odd:
			output += 1
			g = 2
		else:
			g = 1
	return output
x = int(input())
lst = list(map(int, input().split()))
print(count_candy(lst, x))


n = int(input().strip())
weights = list(map(int, input().strip().split()))
res = 0
sum_even = sum(weights[1::2])
sum_odd = sum(weights[2::2])
for idx in range(n):
	if sum_even == sum_odd:
		res += 1
	if idx == n - 1:
		break
	if idx % 2 == 0:
		sum_even += weights[idx]
		sum_even -= weights[idx + 1]
	else:
		sum_odd += weights[idx]
		sum_odd -= weights[idx + 1]
print(res)


q = int(input())
a = [int(j) for j in input().split()]
res = 0
sums = [0, 0]
for i in range(1, len(a)):
	sums[i & 1 ^ 1] += a[i]
if sums[0] == sums[1]:
	res += 1
for i in range(len(a) - 1):
	sums[i & 1] = sums[i & 1] + a[i] - a[i + 1]
	if sums[0] == sums[1]:
		res += 1
print(res)


n = int(input())
a = list(map(int, input().split()))
summ = [0] * n
rev_sum = [0] * n
even = 0
odd = 0
rev_ = 0
_rev = 0
num = 0
for i in range(n):
	if i % 2 == 0:
		even += a[i]
		summ[i] += even
	else:
		odd += a[i]
		summ[i] += odd
	if (n - i - 1) % 2 == 0:
		_rev += a[n - i - 1]
		rev_sum[n - i - 1] += _rev
	else:
		rev_ += a[n - i - 1]
		rev_sum[n - i - 1] += rev_
if n == 1:
	print(1)
elif n == 2:
	print(0)
else:
	for i in range(n):
		if i == 0:
			if rev_sum[1] == rev_sum[2]:
				num += 1
		elif i == n - 1:
			if summ[n - 2] == summ[n - 3]:
				num += 1
		elif i == 1:
			if n == 3:
				if summ[0] == rev_sum[n - 1]:
					num += 1
			elif summ[0] + rev_sum[3] == rev_sum[2]:
				num += 1
		elif i == n - 2 and n > 3:
			if summ[n - 3] == summ[n - 4] + rev_sum[n - 1]:
				num += 1
		elif summ[i - 1] + rev_sum[i + 2] == summ[i - 2] + rev_sum[i + 1]:
			num += 1
	print(num)


import math
n = int(input())
a = list(map(int, input().split()))
if n == 1:
	print(1)
	exit()
a1 = [0] * math.ceil(n / 2)
a2 = [0] * (n // 2)
a1[0] = a[0]
a2[0] = a[1]
ct = 1
for i in range(2, n, 2):
	a1[ct] = a1[ct - 1] + a[i]
	ct += 1
ct = 1
for i in range(3, n, 2):
	a2[ct] = a2[ct - 1] + a[i]
	ct += 1
a1 = [0] + a1
a2 = [0] + a2
ans = 0
s = sum(a)
for i in range(n):
	e = (i + 1) // 2
	o = i // 2
	lhs = a1[e]
	rhs = a2[o]
	rhs = rhs + a1[-1] - a1[e]
	lhs = lhs + a2[-1] - a2[o]
	if i % 2 == 0:
		rhs = s - lhs - a[i]
	else:
		lhs = s - rhs - a[i]
	if rhs == lhs:
		ans += 1
print(ans)


n = int(input())
x = input().split()
x = list(map(int, x))

def isgood(li):
	global leny
	if sum(li[1:leny:2]) == sum(li[0:leny:2]):
		return True
	else:
		return False
leny = len(x)
count = 0
i = 0
odd = sum(x[2:leny:2])
ev = sum(x[1:leny:2])
if odd == ev:
	count += 1
for i in range(1, leny):
	if i % 2 == 0:
		odd -= x[i]
		odd += x[i - 1]
	else:
		ev -= x[i]
		ev += x[i - 1]
	if odd == ev:
		count += 1
print(count)


n = int(input())
candy = [*map(int, input().split())]
numGood = 0
candyOdd = candy[1::2]
candyEven = candy[2::2]
sumOdd = sum(candyOdd)
sumEven = sum(candyEven)
if sumOdd == sumEven:
	numGood += 1
for i in range(1, n):
	if i % 2:
		sumOdd += candy[i - 1] - candy[i]
	else:
		sumEven += candy[i - 1] - candy[i]
	if sumOdd == sumEven:
		numGood += 1
print(numGood)


from sys import stdin, stdout

def inp():
	return stdin.readline()

def minp():
	return map(int, stdin.readline().rstrip().split())

def linp():
	return list(minp())

def main():
	n = int(inp())
	l = linp()
	(ev, od) = (0, 0)
	for i in range(n):
		if i % 2 == 0:
			ev += l[i]
		else:
			od += l[i]
	(a, b, cnt) = (0, 0, 0)
	for i in range(n):
		e = ev
		o = od
		if i % 2 == 0:
			a += l[i]
		else:
			b += l[i]
		e = e - a + b
		o = o - b + a
		if i % 2 == 0:
			o -= l[i]
		else:
			e -= l[i]
		if e == o:
			cnt += 1
	print(cnt)
main()


n = int(input())
lst = list(map(int, input().split()))
(chet1, nechet1, chet2, nechet2) = (0, 0, 0, 0)
for (i, x) in enumerate(lst):
	if i % 2 == 0:
		chet2 += x
	else:
		nechet2 += x
res = 0
for (i, x) in enumerate(lst):
	if i % 2 == 0:
		chet2 -= x
		if chet1 + nechet2 == nechet1 + chet2:
			res += 1
		chet1 += x
	else:
		nechet2 -= x
		if chet1 + nechet2 == nechet1 + chet2:
			res += 1
		nechet1 += x
print(res)


n = int(input())
a = list(map(int, input().split()))
sum = [0] * (n + 2)
pre = [0] * (n + 2)
for i in range(n - 1, -1, -1):
	sum[i] = sum[i + 2] + a[i]
	pre[n - 1 - i] = a[n - 1 - i]
	if n - 2 - i > 0:
		pre[n - 1 - i] += pre[n - i - 3]
ans = 0
for i in range(n):
	odd_sum = sum[i + 1]
	even_sum = sum[i + 2]
	if i - 2 >= 0:
		odd_sum += pre[i - 2]
	if i - 1 >= 0:
		even_sum += pre[i - 1]
	if odd_sum == even_sum:
		ans += 1
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
los = 0
les = 0
ros = 0
res = 0
for i in range(n):
	if i % 2 == 0:
		ros += a[i]
	else:
		res += a[i]
ans = 0
for i in range(n):
	if i % 2 == 0:
		ros -= a[i]
	else:
		res -= a[i]
	if los + res == les + ros:
		ans += 1
	if i % 2 == 0:
		los += a[i]
	else:
		les += a[i]
print(ans)


n = int(input())
l = [*map(int, input().split())]
(e_pre, o_pre) = ([0], [0])
for (i, e) in enumerate(l):
	if i & 1:
		e_pre.append(e_pre[-1] + e)
		o_pre.append(o_pre[-1])
	else:
		o_pre.append(o_pre[-1] + e)
		e_pre.append(e_pre[-1])
o_pre.append(o_pre[-1])
e_pre.append(e_pre[-1])
res = 0
for (i, ele) in enumerate(l):
	e = e_pre[i] + (o_pre[-1] - o_pre[i + 1])
	o = o_pre[i] + (e_pre[-1] - e_pre[i + 1])
	if e == o:
		res += 1
print(res)


import math
import bisect
import itertools
import sys
I = lambda : sys.stdin.readline()
mod = 10 ** 9 + 7

def modu(a, m):
	if a % m:
		return a % m
	return m

def mindiff(a):
	b = a[:]
	b.sort()
	m = 10000000000
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] < m:
			m = b[i + 1] - b[i]
	return m

def lcm(a, b):
	return a * b // math.gcd(a, b)

def merge(a, b):
	i = 0
	j = 0
	c = 0
	ans = []
	while i < len(a) and j < len(b):
		if a[i] < b[j]:
			ans.append(a[i])
			i += 1
		else:
			ans.append(b[j])
			c += len(a) - i
			j += 1
	ans += a[i:]
	ans += b[j:]
	return (ans, c)

def mergesort(a):
	if len(a) == 1:
		return (a, 0)
	mid = len(a) // 2
	(left, left_inversion) = mergesort(a[:mid])
	(right, right_inversion) = mergesort(a[mid:])
	(m, c) = merge(left, right)
	c += left_inversion + right_inversion
	return (m, c)

def is_prime(num):
	if num == 1:
		return False
	if num == 2:
		return True
	if num == 3:
		return True
	if num % 2 == 0:
		return False
	if num % 3 == 0:
		return False
	t = 5
	a = 2
	while t <= int(math.sqrt(num)):
		if num % t == 0:
			return False
		t += a
		a = 6 - a
	return True

def ceil(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def binsearch(arr, b, low, high):
	if low == high:
		return low
	if arr[math.ceil((low + high) / 2)] < b:
		return binsearch(arr, b, low, math.ceil((low + high) / 2) - 1)
	else:
		return binsearch(arr, b, math.ceil((low + high) / 2), high)

def ncr1(n, r):
	s = 1
	for i in range(min(n - r, r)):
		s *= n - i
		s %= mod
		s *= pow(i + 1, mod - 2, mod)
		s %= mod
	return s

def calc(n, m, r):
	s = 0
	for i in range(0, r + 1, 2):
		s += ncr1(n, i) * ncr1(m, i)
		s %= mod
	return s
n = int(input())
a = list(map(int, input().split()))
e = 0
o = 0
for i in range(n):
	if i % 2:
		e += a[i]
	else:
		o += a[i]
c = 0
ee = [0] * (n + 1)
oo = [0] * (n + 1)
o1 = 0
e1 = 0
for i in range(n - 1, -1, -1):
	if i % 2 == 0:
		oo[i] = o1 + a[i]
		ee[i] = e1
		o1 = oo[i]
	else:
		oo[i] = o1
		ee[i] = e1 + a[i]
		e1 = ee[i]
oo = [oo[0]] + oo
ee = [ee[0]] + ee
for i in range(1, n + 1):
	if i % 2 == 1 and oo[0] - oo[i] + ee[i + 1] == oo[i + 1] + ee[0] - ee[i]:
		c += 1
	elif i % 2 == 0 and oo[0] - oo[i] + ee[i + 1] == oo[i + 1] + ee[0] - ee[i]:
		c += 1
print(c)


n = int(input())
a = [int(x) for x in input().split()]
a.insert(0, 0)
s1 = [0] * (n + 1)
s2 = [0] * (n + 1)
for i in range(1, n + 1):
	if i % 2 == 1:
		if i != 1:
			s1[i] = s1[i - 2] + a[i]
		else:
			s1[i] = a[i]
	elif i != 2:
		s2[i] = s2[i - 2] + a[i]
	else:
		s2[i] = a[i]
if n % 2 == 0:
	s1[n] = s1[n - 1]
if n % 2 == 1:
	s2[n] = s2[n - 1]
ans = 0
for i in range(1, n + 1):
	if i == 1:
		if s2[n] == s1[n] - s1[i]:
			ans += 1
		continue
	if i == 2:
		if s1[i - 1] + s2[n] - s2[i] == s1[n] - s1[i - 1]:
			ans += 1
		continue
	if i % 2 == 1:
		if s1[i - 2] + s2[n] - s2[i - 1] == s2[i - 1] + s1[n] - s1[i]:
			ans += 1
	elif s1[i - 1] + s2[n] - s2[i] == s2[i - 2] + s1[n] - s1[i - 1]:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
odd = [0]
even = [0]
for i in range(n):
	if i % 2 == 0:
		odd.append(odd[-1] + a[i])
	else:
		even.append(even[-1] + a[i])
ans = 0
for i in range(1, n + 1):
	if i % 2 == 0:
		oddtotal = odd[i // 2] + (even[-1] - even[i // 2])
		eventotal = even[i // 2 - 1] + (odd[-1] - odd[i // 2])
	else:
		oddtotal = odd[i // 2] + (even[-1] - even[i // 2])
		eventotal = even[i // 2] + (odd[-1] - odd[i // 2 + 1])
	if oddtotal == eventotal:
		ans += 1
print(ans)


n = int(input())
a = [0] + list(map(int, input().split()))
o = [0] * (n + 1)
e = [0] * (n + 1)
for i in range(1, n + 1):
	if i & 1:
		o[i] = o[i - 1] + a[i]
		e[i] = e[i - 1]
	else:
		o[i] = o[i - 1]
		e[i] = e[i - 1] + a[i]
(x, y) = (0, 0)
cnt = 0
for i in range(1, n + 1):
	if i & 1:
		y = o[i - 1] + e[n] - e[i]
		x = e[i] + o[n] - o[i]
	else:
		x = e[i - 1] + o[n] - o[i]
		y = o[i] + e[n] - e[i]
	if x == y:
		cnt += 1
print(cnt)


n = int(input())
arr = list(map(int, input().split()))
count = 0
s = sum(arr)
es = 0
os = 0
for i in range(n):
	if (i + 1) % 2 == 1:
		os += arr[i]
	else:
		es += arr[i]
(b4e, b4o, ae, ao) = ([0], [arr[0]], [es], [os - arr[0]])
for i in range(1, n):
	if (i + 1) % 2:
		b4e.append(b4e[-1])
		ae.append(ae[-1])
		b4o.append(b4o[-1] + arr[i])
		ao.append(ao[-1] - arr[i])
	else:
		b4e.append(b4e[-1] + arr[i])
		ae.append(ae[-1] - arr[i])
		b4o.append(b4o[-1])
		ao.append(ao[-1])
b4e = [0] + b4e[:n - 1]
b4o = [0] + b4o[:n - 1]
for i in range(n):
	if b4e[i] + ao[i] - b4o[i] - ae[i] == 0:
		count += 1
print(count)


n = 0
even_suffix = 0
odd_suffix = 0
even_prefix = 0
odd_prefix = 0
n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	if i % 2 != 0:
		even_suffix += l[i]
	else:
		odd_suffix += l[i]
count = 0
for i in range(n):
	if i % 2 != 0:
		even_suffix -= l[i]
	else:
		odd_suffix -= l[i]
	if even_prefix + odd_suffix == even_suffix + odd_prefix:
		count += 1
	if i % 2 != 0:
		even_prefix += l[i]
	else:
		odd_prefix += l[i]
print(count)


n = int(input())
arr = list(map(int, input().split(' ')))
even_sum = 0
odd_sum = 0
for i in range(1, n + 1):
	if i % 2 == 0:
		even_sum += arr[i - 1]
	else:
		odd_sum += arr[i - 1]
curr_even = 0
curr_odd = 0
res = 0
for i in range(n):
	if (i + 1) % 2 == 0:
		if curr_odd + even_sum - arr[i] == curr_even + odd_sum:
			res += 1
		curr_even += arr[i]
		even_sum -= arr[i]
	else:
		if curr_even + odd_sum - arr[i] == curr_odd + even_sum:
			res += 1
		curr_odd += arr[i]
		odd_sum -= arr[i]
print(res)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(1)
		return
	(even, odd) = ([0], [0])
	for i in range(n):
		if i % 2 == 0:
			even.append(a[i] + even[-1])
		else:
			odd.append(a[i] + odd[-1])
	ret = 0
	for i in range(n):
		pos = i // 2 + 1
		if i % 2 == 1:
			num1 = even[pos] + odd[-1] - odd[pos]
			num2 = odd[pos - 1] + even[-1] - even[pos]
		else:
			num1 = even[pos - 1] + odd[-1] - odd[pos - 1]
			num2 = odd[pos - 1] + even[-1] - even[pos]
		if num1 == num2:
			ret += 1
	print(ret)
main()


n = int(input())
a = list(map(int, input().split()))
odd_s = 0
even_s = 0
sums = [0] * n
for i in range(n):
	if i % 2 == 0:
		odd_s = odd_s + a[i]
		sums[i] = odd_s
	else:
		even_s = even_s + a[i]
		sums[i] = even_s
count = 0
if odd_s - a[0] == even_s:
	count = 1
for i in range(1, n):
	if i % 2 != 0:
		po = sums[i - 1]
		pe = sums[i]
		eo = odd_s - po
		ee = even_s - pe
		if po + ee == pe + eo - a[i]:
			count = count + 1
	else:
		pe = sums[i - 1]
		po = sums[i]
		eo = odd_s - po
		ee = even_s - pe
		if po + ee - a[i] == pe + eo:
			count = count + 1
print(count)


from sys import stdin
n = int(stdin.readline().strip())
candy = list(map(int, stdin.readline().split()))
odd = candy[1::2]
even = candy[2::2]
odd_sum = sum(odd)
even_sum = sum(even)
ans = 0
if odd_sum == even_sum:
	ans += 1
for i in range(1, n):
	if i % 2 == 1:
		odd_sum += candy[i - 1] - candy[i]
	else:
		even_sum += candy[i - 1] - candy[i]
	if odd_sum == even_sum:
		ans += 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
i = 0
k = 0
sn1 = 0
sn2 = 0
sk1 = 0
sk2 = 0
while i < n:
	if i % 2 == 0:
		sk1 += l[i]
	else:
		sk2 += l[i]
	i += 1
i = 0
while i < n:
	if i % 2 == 0:
		if i > 0:
			sn1 += l[i - 1]
		sk1 -= l[i]
		if sn1 + sk1 == sk2 + sn2:
			k += 1
	else:
		if i > 0:
			sn2 += l[i - 1]
		sk2 -= l[i]
		if sn2 + sk2 == sk1 + sn1:
			k += 1
	i += 1
print(k)


n = int(input())
a = list(map(int, input().split()))
o = a[1::2]
e = a[2::2]
x = sum(o)
y = sum(e)
ans = 0
if x == y:
	ans += 1
for i in range(1, n):
	if i % 2 == 1:
		x += a[i - 1] - a[i]
	else:
		y += a[i - 1] - a[i]
	if x == y:
		ans += 1
print(ans)


n = int(input())
u = list(map(int, input().split()))
a0 = [0] * n
a1 = [0] * n
a0[0] = u[0]
for i in range(1, n):
	a0[i] = a0[i - 1]
	a1[i] = a1[i - 1]
	if i % 2 == 0:
		a0[i] += u[i]
	else:
		a1[i] += u[i]
b0 = [0] * n
b1 = [0] * n
if n % 2 == 0:
	b0[-1] = u[-1]
else:
	b1[-1] = u[-1]
for i in range(n - 2, -1, -1):
	b0[i] = b0[i + 1]
	b1[i] = b1[i + 1]
	if (n - i - 1) % 2 == n % 2:
		b0[i] += u[i]
	else:
		b1[i] += u[i]
ans = 0
for i in range(n):
	if a0[i] + b0[i] == a1[i] + b1[i]:
		ans += 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
m = [0] * n
e = 0
o = 0
for i in range(n):
	if (i + 1) % 2 == 0:
		e += l[i]
		m[i] = 1
	else:
		o += l[i]
		m[i] = 2
o -= l[0]
c = 0
if e == o:
	c += 1
for i in range(1, n):
	if m[i] == 1:
		e -= l[i]
		e += l[i - 1]
		if e == o:
			c += 1
	else:
		o -= l[i]
		o += l[i - 1]
		if e == o:
			c += 1
print(c)


input()
a = [*map(int, input().split())]
s = [sum(a[::2]), sum(a[1::2])]
r = i = 0
for (x, y) in zip([0] + a, a):
	s[i] += x - y
	r += s[0] == s[1]
	i ^= 1
print(r)


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = [2]
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(3, limit + 1, 2):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	n = inp()
	l = li()
	x = []
	(o, e) = (0, 0)
	for i in range(n):
		if i & 1:
			o += l[i]
		else:
			e += l[i]
		x.append([o, e])
	c = 0
	for i in range(n):
		if i & 1:
			a = x[i][0] - l[i]
			b = x[-1][1] - x[i][1]
			p = x[i][1]
			q = x[-1][0] - x[i][0]
			if a + b == p + q:
				c += 1
		else:
			a = x[i][1] - l[i]
			b = x[-1][0] - x[i][0]
			p = x[i][0]
			q = x[-1][1] - x[i][1]
			if a + b == p + q:
				c += 1
	print(c)
for _ in range(1):
	solve()


import sys
a = int(input())
tab = list(map(int, input().split()))
if len(tab) == 1:
	print(1)
	sys.exit()
odd = sum(tab[2::2])
even = sum(tab[1::2])
l = 0
r = 0
ans = 0
if odd == even:
	ans += 1
for (i, j) in enumerate(tab[1:]):
	if i % 2 == 0:
		l += tab[i]
		even -= j
	else:
		r += tab[i]
		odd -= j
	if even + l == odd + r:
		ans += 1
print(ans)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	n = I()
	a = LI()
	u = [0]
	for c in a[::-1]:
		u.append(c - u[-1])
	u = u[::-1]
	t = 0
	r = 0
	for i in range(n):
		k = t - u[i + 1]
		if k == 0:
			r += 1
		t = a[i] - t
	return r
print(main())


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	a = lis()
	preeven = [0] * (n + 1)
	preodd = [0] * (n + 1)
	for i in range(n):
		if i % 2 == 0:
			preeven[i] = preeven[i - 1] + a[i]
			preodd[i] = preodd[i - 1]
		else:
			preodd[i] = preodd[i - 1] + a[i]
			preeven[i] = preeven[i - 1]
	cnt = 0
	for i in range(n):
		if i % 2 == 0:
			a1 = preodd[i] + preeven[n - 1] - preeven[i]
			a2 = preeven[i - 1] + preodd[n - 1] - preodd[i]
			if a1 == a2:
				cnt += 1
		else:
			a1 = preodd[i - 1] + preeven[n - 1] - preeven[i]
			a2 = preeven[i] + preodd[n - 1] - preodd[i]
			if a1 == a2:
				cnt += 1
	print(cnt)
testcase(1)


n = int(input())
a = list(map(int, input().split()))
eLeft = 0
oLeft = 0
eRight = 0
oRight = 0
for i in range(n):
	if i % 2 == 0:
		eRight += a[i]
	else:
		oRight += a[i]
ans = 0
for i in range(n):
	if i % 2 == 0:
		eRight -= a[i]
	else:
		oRight -= a[i]
	if eLeft + oRight == oLeft + eRight:
		ans += 1
	if i % 2 == 0:
		eLeft += a[i]
	else:
		oLeft += a[i]
print(ans)


from itertools import accumulate
from math import ceil
n = int(input())
a = list(map(int, input().split()))
oddprea = list(accumulate((a[i] for i in range(n) if i % 2 == 0)))
evenprea = list(accumulate((a[i] for i in range(n) if i % 2 == 1)))
oddsuffa = list(accumulate((a[i] for i in range(n - 1, -1, -1) if i % 2 == 0)))
evensuffa = list(accumulate((a[i] for i in range(n - 1, -1, -1) if i % 2 == 1)))
count = 0
for i in range(n):
	if i % 2 == 0:
		if (oddprea[i // 2 - 1] if i > 0 else 0) + (evensuffa[n // 2 - i // 2 - 1] if n // 2 - i // 2 - 1 >= 0 else 0) == (evenprea[i // 2 - 1] if i // 2 - 1 >= 0 else 0) + (oddsuffa[(n - 1) // 2 - i // 2 - 1] if (n - 1) // 2 - i // 2 - 1 >= 0 else 0):
			count += 1
	elif (oddprea[(i + 1) // 2 - 1] if i > 0 else 0) + (evensuffa[n // 2 - i // 2 - 2] if n // 2 - i // 2 - 1 > 0 else 0) == (evenprea[i // 2 - 1] if i // 2 - 1 >= 0 else 0) + (oddsuffa[(n - 1) // 2 - i // 2 - 1] if (n - 1) // 2 - i // 2 - 1 >= 0 else 0):
		count += 1
print(count)


n = int(input())
a = input()
l = list(map(int, a.split()))
s = sum(l)
so = 0
se = 0
m = 0
so1 = 0
se1 = 0
so2 = 0
se2 = 0
for i in range(n):
	if i % 2 == 0:
		so = so + l[i]
	else:
		se = se + l[i]
for i in range(n):
	if i % 2 != 0:
		se = se - l[i]
		se2 = se2 + l[i]
	so1 = so2 + se
	se1 = se2 + so - l[i]
	if i % 2 == 0:
		so = so - l[i]
		so2 = so2 + l[i]
	if so1 == se1:
		m = m + 1
print(m)


n = int(input())
a = list(map(int, input().split()))
sum1 = [0]
sum2 = [0]
for i in range(n):
	if i % 2 == 0:
		sum1.append(sum1[-1] + a[i])
		sum2.append(sum2[-1])
	else:
		sum2.append(sum2[-1] + a[i])
		sum1.append(sum1[-1])
ans = 0
for i in range(n):
	if i % 2 == 0:
		SUM1 = sum1[i]
		SUM2 = sum2[i]
		(SUM1, SUM2) = (SUM1 + sum2[-1] - SUM2, SUM2 + sum1[-1] - a[i] - SUM1)
		if SUM1 == SUM2:
			ans += 1
	else:
		SUM1 = sum1[i]
		SUM2 = sum2[i]
		(SUM1, SUM2) = (SUM1 + sum2[-1] - a[i] - SUM2, SUM2 + sum1[-1] - SUM1)
		if SUM1 == SUM2:
			ans += 1
print(ans)


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def main():
	n = int(input())
	arr = get_array()
	odd = [0] * (n + 1)
	even = [0] * (n + 1)
	for i in range(1, n + 1):
		if i % 2 == 1:
			even[i] = even[i - 1]
			if i == 1:
				odd[i] = arr[i - 1]
			else:
				odd[i] += odd[i - 2] + arr[i - 1]
		else:
			even[i] += even[i - 2] + arr[i - 1]
			odd[i] = odd[i - 1]
	ans = 0
	for i in range(1, n + 1):
		x = odd[i - 1] + (even[-1] - even[i])
		y = even[i - 1] + (odd[-1] - odd[i])
		if x == y:
			ans += 1
	print(ans)
main()


import time
n = int(input())
a = [int(_) for _ in input().split()]
start = time.time()
sb1 = 0
sb2 = 0
se1 = sum(a[::2])
se2 = sum(a[1::2])
ans = 0
flag = False
for i in range(n):
	se1 -= a[i]
	if sb1 + se2 == sb2 + se1:
		ans += 1
	sb1 += a[i]
	(sb1, sb2, se1, se2) = (sb2, sb1, se2, se1)
print(ans)
finish = time.time()


n = int(input())
odd = True
odd_sum = []
even_sum = []
ns = []
for j in input().split(' '):
	i = int(j)
	ns.append(i)
	if odd == True:
		if len(odd_sum) == 0:
			odd_sum.append(i)
			even_sum.append(0)
		else:
			v = odd_sum[-1]
			odd_sum.append(v + i)
			v = even_sum[-1]
			even_sum.append(v)
		odd = False
	else:
		v = even_sum[-1]
		even_sum.append(v + i)
		v = odd_sum[-1]
		odd_sum.append(v)
		odd = True
ans = 0
for i in range(n):
	if i == 0:
		if odd_sum[-1] - ns[0] == even_sum[-1]:
			ans = ans + 1
	elif i == n - 1:
		if n % 2 == 1:
			if odd_sum[-1] - ns[-1] == even_sum[-1]:
				ans = ans + 1
		elif even_sum[-1] - ns[-1] == odd_sum[-1]:
			ans = ans + 1
	elif odd_sum[i - 1] + (even_sum[-1] - even_sum[i]) == even_sum[i - 1] + (odd_sum[-1] - odd_sum[i]):
		ans = ans + 1
print(ans)


n = int(input())
b = input().split(' ')
delta = [0]
for i in range(n):
	delta.append(delta[-1] + int(b[i]) * (-1) ** i)

def testss(i):
	if i > 0:
		if b[i] == b[i - 1]:
			return res[-1]
	delta1 = delta[i]
	delta2 = delta[-1] - delta[i + 1]
	if delta2 == delta1:
		return 1
	return 0
res = []
for i in range(n):
	res.append(testss(i))
print(sum(res))


n = int(input())
a = list(map(int, input().split()))
so = 0
se = 0
for i in range(n):
	if i > 0:
		if i % 2 == 0:
			so += a[i]
		else:
			se += a[i]
co = 0
for i in range(n):
	if i % 2 == 0:
		if i > 0:
			so = so - a[i] + a[i - 1]
		if so == se:
			co += 1
	else:
		se = se - a[i] + a[i - 1]
		if so == se:
			co += 1
print(co)


n = int(input())
arr = list(map(int, input().split()))
(f1, f2, s1, s2) = (0, 0, 0, 0)
for (ind, el) in enumerate(arr):
	if ind % 2:
		f2 += el
	else:
		s2 += el
res = 0
for (ind, el) in enumerate(arr):
	if ind % 2:
		f2 -= el
	else:
		s2 -= el
	if f1 + f2 == s1 + s2:
		res += 1
	if ind % 2:
		s1 += el
	else:
		f1 += el
print(res)


def main():
	nbCandies = int(input())
	candTab = list(map(int, input().split()))
	pairSomme = 0
	impairSomme = 0
	for (indCandy, candy) in enumerate(candTab):
		if indCandy % 2 == 0:
			pairSomme += candy
		else:
			impairSomme += candy
	curpSomme = 0
	curimpSomme = 0
	nbGoods = 0
	for (indCandy, candy) in enumerate(candTab):
		if indCandy % 2 == 0:
			pairSomme -= candy
		else:
			impairSomme -= candy
		if pairSomme + curimpSomme == impairSomme + curpSomme:
			nbGoods += 1
		if indCandy % 2 == 0:
			curpSomme += candy
		else:
			curimpSomme += candy
	print(nbGoods)
main()


n = int(input())
A = [0] + [int(x) for x in input().split()]
pref_A = [0]
result = 0
for i in range(1, len(A)):
	pref_A += [pref_A[-1] + (2 * (i % 2) - 1) * A[i]]
for i in range(1, len(A)):
	result += pref_A[i - 1] - pref_A[0] - (pref_A[-1] - pref_A[i]) == 0
print(result)


n = int(input())
arr = list(map(int, input().strip().split()))
x = sum(arr)
ans = 0
o = [0] * (n + 1)
e = [0] * (n + 1)
for i in range(1, n + 1):
	if i % 2 == 0:
		e[i] += arr[i - 1]
	else:
		o[i] += arr[i - 1]
	e[i] += e[i - 1]
	o[i] += o[i - 1]
for i in range(1, n + 1):
	if i % 2 == 0:
		if o[n] - o[i] + e[i] - arr[i - 1] == e[n] - e[i] + o[i]:
			ans += 1
	elif o[n] - o[i] + e[i] == e[n] - e[i] + o[i] - arr[i - 1]:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
ch = 0
nch = 0
ch1 = 0
nch1 = 0
for i in range(n):
	if (i + 1) % 2 == 0:
		ch += a[i]
	else:
		nch += a[i]
ans = 0
for i in range(n):
	if (i + 1) % 2 == 0:
		ch -= a[i]
	else:
		nch -= a[i]
	if nch + ch1 == ch + nch1:
		ans += 1
	if (i + 1) % 2 == 0:
		ch1 += a[i]
	else:
		nch1 += a[i]
print(ans)


n = int(input())
w = list(map(int, input().split()))
(se, so) = [sum(w[::2]), sum(w[1::2])]
c = 0
(de, do) = (0, 0)
for i in range(n):
	if i % 2 == 0:
		se -= w[i]
		if se + do == so + de:
			c += 1
		de += w[i]
	else:
		so -= w[i]
		if se + do == so + de:
			c += 1
		do += w[i]
print(c)


n = int(input())
count = 0
cost = list(map(int, input().split()))
if n - 1:
	even = [cost[0]]
	odd = [0, cost[1]]
	for i in range(1, len(cost)):
		if not i % 2:
			even.append(even[i - 1] + cost[i])
		else:
			even.append(even[i - 1])
	for i in range(2, len(cost)):
		if i % 2:
			odd.append(odd[i - 1] + cost[i])
		else:
			odd.append(odd[i - 1])
	n -= 1
	for i in range(n + 1):
		if not i:
			if odd[n] == even[n] - cost[0]:
				count += 1
		elif i == 1:
			if cost[0] + odd[n] - cost[1] == even[n] - cost[0]:
				count += 1
		elif i == n:
			if odd[n - 1] == even[n - 1]:
				count += 1
		elif i % 2:
			if odd[i - 2] + even[n] - even[i - 1] == even[i - 1] + odd[n] - odd[i]:
				count += 1
		elif even[i - 1] + odd[n] - odd[i] == odd[i - 1] + even[n] - even[i]:
			count += 1
	print(count)
else:
	print(1)


n = int(input())
a = [*map(int, input().split())]
s = [0, 0]
for x in a:
	s += (s[-2] + x,)
print(sum((2 * (s[i] + s[-1 - (n - i) % 2] - s[i + 1]) + a[i] == s[-1] + s[-2] for i in range(n))))


n = int(input())
a = [int(popp) for popp in input().split()]
even_array = [0] * (n + 5)
array_of_odd_numbers = [0] * (n + 5)
sums_of_takla = 0
b = a[::-1]
array_of_sums = [0] * n
even_array = [0] * (n + 5)
array_of_odd_numbers = [0] * (n + 5)
sums_of_takla = 0
sums_of_ganja = 0
for i in range(n):
	if i % 2 == 0:
		sums_of_takla += a[i]
		b[i] = 0
		array_of_sums[i] = sums_of_takla
		array_of_odd_numbers[i] = sums_of_ganja
		even_array[i] = sums_of_takla
	else:
		b[i] = 0
		sums_of_ganja += a[i]
		b[i] = 0
		array_of_sums[i] = sums_of_ganja
		array_of_odd_numbers[i] = sums_of_ganja
		b[i] = 1
		even_array[i] = sums_of_takla
answer = 0
for i in range(n):
	if i % 2 == 0:
		if sums_of_takla - even_array[i] + array_of_odd_numbers[i - 1] == sums_of_ganja - array_of_odd_numbers[i - 1] + even_array[i - 1]:
			b[i] = a[i]
			answer += 1
	elif sums_of_ganja - array_of_odd_numbers[i] + even_array[i - 1] == sums_of_takla - even_array[i - 1] + array_of_odd_numbers[i - 1]:
		b[i] = 0
		answer += 1
print(answer)


n = int(input())
l = list(map(int, input().split()))
c = 0
d = 0
t = 0
for i in range(1, n):
	if i % 2 == 0:
		c = c + l[i]
	else:
		d = d + l[i]
if c == d:
	t += 1
else:
	t = 0
for j in range(1, n):
	if j % 2 == 0:
		c -= int(l[j])
		c += l[j - 1]
		if c == d:
			t = t + 1
	else:
		d = d - int(l[j])
		d += l[j - 1]
		if d == c:
			t = t + 1
print(t)


t = '1 4 3 3'
n_ = int(input())
nums = list(map(int, input().split()))
prev_ch = 0
prev_nch = 0
for (i, n) in enumerate(nums):
	ch = i % 2
	prev_ch = prev_ch if ch else prev_ch + n
	prev_nch = prev_nch + n if ch else prev_nch
	nums[i] = (i, prev_ch, prev_nch, nums[i])

def check(th, nums):
	ch = nums[th][1]
	nch = nums[th][2]
	mch_ = nums[th][3] if not th % 2 else 0
	mnch_ = nums[th][3] if th % 2 else 0
	ch_ = ch - mch_ + (nums[-1][2] - nch)
	nch_ = nch - mnch_ + (nums[-1][1] - ch)
	return ch_ == nch_
res = 0
for th in range(len(nums)):
	res = res + 1 if check(th, nums) else res
print(res)


t = int(input())
arr = [int(x) for x in input().split()]
count = 0
arr2 = [[0 for i in range(2)] for j in range(t + 1)]
arr3 = [[0 for i in range(2)] for j in range(t + 1)]
odd = 0
even = 0
ma = 0
for i in range(t):
	if ma == 0:
		odd += arr[i]
		ma = 1
	else:
		even += arr[i]
		ma = 0
	arr2[i + 1][0] = odd
	arr2[i + 1][1] = even
ma = 0
even = 0
odd = 0
arr2[0][0] = 0
arr2[0][0] = 0
for i in range(t):
	if ma == 0:
		even += arr[t - i - 1]
		ma = 1
	else:
		odd += arr[t - 1 - i]
		ma = 0
	arr3[i + 1][0] = odd
	arr3[i + 1][1] = even
if t % 2 == 1:
	count = 0
	for i in range(t):
		odd = arr3[t - 1 - i][0] + arr2[i][0]
		even = arr3[t - 1 - i][1] + arr2[i][1]
		if odd == even:
			count += 1
	print(count)
if t % 2 == 0:
	count = 0
	for i in range(t):
		odd = arr3[t - 1 - i][0] + arr2[i][1]
		even = arr3[t - 1 - i][1] + arr2[i][0]
		if odd == even:
			count += 1
	print(count)


def ia():
	return list(map(int, input().split()))

def ca():
	return input().split()

def ii():
	return int(input())
n = int(input())
a = ia()
s = [0] * n
a1 = 0
a2 = 0
for i in range(n):
	if i % 2 == 0:
		a1 += a[i]
		s[i] = a1
	else:
		a2 += a[i]
		s[i] = a2
count = 0
for i in range(n):
	if i == 0 and a1 - a[i] == a2:
		count += 1
	elif i == 1 and s[i - 1] + a2 - s[i] == a1 - s[0]:
		count += 1
	elif i != 0 and i % 2 == 0 and (s[i - 2] + a2 - s[i - 1] == s[i - 1] + a1 - s[i]):
		count += 1
	elif i != 1 and i % 2 == 1 and (s[i - 1] + a2 - s[i] == s[i - 2] + a1 - s[i - 1]):
		count += 1
print(count)


n = int(input())
a = [int(s) for s in input().split()]
cou = 0
s1 = sum(a[::2])
s = sum(a)
s2 = s - s1
sp1 = 0
sp2 = 0
if n == 1:
	cou = 1
elif n == 2:
	cou = 0
elif n > 2:
	for i in range(n):
		if i % 2 == 0:
			s1 -= a[i]
		else:
			s2 -= a[i]
		if sp1 + s2 == sp2 + s1:
			cou += 1
		if i % 2 == 0:
			sp1 += a[i]
		else:
			sp2 += a[i]
print(cou)


import sys

def main():
	n = int(sys.stdin.readline())
	arr = [int(x) for x in sys.stdin.readline().split(' ')]
	dp = [0] * (n + 2)
	dp[n] = 0
	dp[n + 1] = 0
	for i in range(n - 1, -1, -1):
		if i + 2 < n:
			dp[i] = arr[i] + dp[i + 2]
		else:
			dp[i] = arr[i]
	even = 0
	odd = 0
	count = 0
	for i in range(n):
		if i % 2 == 0:
			fullEven = even + dp[i + 1]
			fullOdd = odd + dp[i + 2]
			if fullEven == fullOdd:
				count += 1
			even += arr[i]
		else:
			fullEven = even + dp[i + 2]
			fullOdd = odd + dp[i + 1]
			if fullEven == fullOdd:
				count += 1
			odd += arr[i]
	return count
print(main())


n = int(input())
A = [int(i) for i in input().split()]
ans = 0
S = [0, 0]
for (i, a) in enumerate(A):
	S[i % 2] += a
S[0] -= A[0]
if S[0] == S[1]:
	ans += 1
for i in range(1, n):
	S[i % 2] -= A[i]
	S[i % 2] += A[i - 1]
	if S[0] == S[1]:
		ans += 1
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
e = [0]
o = [0]
se = 0
so = 0
for i in range(len(a)):
	if i % 2 == 0:
		so += a[i]
		o.append(so)
	else:
		se += a[i]
		e.append(se)
count = 0
for i in range(len(a)):
	slefto = o[(i + 1) // 2]
	srighto = e[-1] - e[(i + 1) // 2]
	odd = slefto + srighto
	even = se + so - odd - a[i]
	if odd == even:
		count += 1
print(count)


n = int(input())
R = 0
o = 0
e = 0
p = input().rstrip().split(' ')
for i in range(0, len(p)):
	if i % 2 == 0:
		o = o + int(p[i])
	else:
		e = e + int(p[i])
for i in range(0, len(p)):
	if i == 0:
		temp = o
		o = e
		e = temp - int(p[i])
		if o == e:
			R += 1
	elif i % 2 != 0:
		o = o + int(p[i - 1]) - int(p[i])
		if e == o:
			R += 1
	elif i % 2 == 0:
		e = e + int(p[i - 1]) - int(p[i])
		if e == o:
			R += 1
print(R)


n = int(input())
a = list(map(int, input().split()))
b = [0] * (n + 1)
c = [0] * (n + 1)
ans = 0
for i in range(1, n + 1):
	if i % 2 != 0:
		b[i] = b[i - 1] + a[i - 1]
	else:
		b[i] = b[i - 1] - a[i - 1]
a.reverse()
for i in range(1, n + 1):
	if i % 2 != 0:
		c[i] = c[i - 1] + a[i - 1]
	else:
		c[i] = c[i - 1] - a[i - 1]
if n % 2 == 0:
	for i in range(n):
		ans += b[i] + c[n - 1 - i] == 0
	print(ans)
else:
	for i in range(n):
		ans += b[i] - c[n - 1 - i] == 0
	print(ans)


n = int(input())
a = list(map(int, input().split()))
forward = [0] * (n + 2)
backward = [0] * (n + 2)
forward[0] = [0, 0]
backward[-1] = [0, 0]
for ind in range(n):
	item = [0, 0]
	item[ind % 2] = a[ind]
	forward[ind + 1] = [forward[ind][0] + item[0], forward[ind][1] + item[1]]
	item = [0, 0]
	item[(n - ind) % 2] = a[n - ind - 1]
	backward[n - ind] = [backward[n - ind + 1][0] + item[0], backward[n - ind + 1][1] + item[1]]
count = 0
for ind in range(0, n):
	if forward[ind][0] + backward[ind + 2][0] == forward[ind][1] + backward[ind + 2][1]:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
(suf2, suf1) = (0, 0)
for i in range(n):
	if i % 2:
		suf2 += a[i]
	else:
		suf1 += a[i]
(ans, pref2, pref1) = (0, 0, 0)
for i in range(n):
	if i % 2:
		suf2 -= a[i]
	else:
		suf1 -= a[i]
	if suf2 + pref1 == suf1 + pref2:
		ans += 1
	if i % 2:
		pref2 += a[i]
	else:
		pref1 += a[i]
print(ans)


n = int(input())
weights = list(map(int, input().split()))
number_good = 0
even_sum = 0
odd_sum = 0
for i in range(n):
	if i % 2 == 0:
		odd_sum += weights[i]
	else:
		even_sum += weights[i]
temp_esum = 0
temp_osum = 0
b_esum = 0
b_osum = 0
for i in range(n - 1, -1, -1):
	temp_esum = even_sum
	temp_osum = odd_sum
	if i % 2 == 0:
		temp_osum -= weights[i]
		temp_osum = temp_osum - b_osum + b_esum
		temp_esum = temp_esum + b_osum - b_esum
		b_osum += weights[i]
	else:
		temp_esum -= weights[i]
		temp_osum = temp_osum - b_osum + b_esum
		temp_esum = temp_esum + b_osum - b_esum
		b_esum += weights[i]
	if temp_esum == temp_osum:
		number_good += 1
print(number_good)


n = int(input())
a = list(map(int, input().split()))
b = [0]
c = [0, 0]
for i in range(0, n, 2):
	b.append(b[-1] + a[i])
	b.append(b[-1])
	if i + 1 < n:
		c.append(c[-1] + a[i + 1])
		c.append(c[-1])
ans = 0
for i in range(n):
	k1 = 0
	k2 = 0
	k1 += b[i] + c[n] - c[i + 1]
	k2 += c[i] + b[n] - b[i + 1]
	if k1 == k2:
		ans += 1
print(ans)


import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5:
	from math import gcd
else:
	from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def round(x):
	return int((x * 2 + 1) // 2)

def fermat(x, y, MOD):
	return x * pow(y, MOD - 2, MOD) % MOD

def lcm(x, y):
	return x * y // gcd(x, y)

def lcm_list(nums):
	return reduce(lcm, nums, 1)

def gcd_list(nums):
	return reduce(gcd, nums, nums[0])

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
N = INT()
A = LIST()
if N == 1:
	print(1)
	exit()
dad = A[0]
odd = 0
even = 0
for i in range(1, N):
	if i % 2 == 1:
		odd += A[i]
	else:
		even += A[i]
cnt = 0
if odd == even:
	cnt += 1
for i in range(1, N):
	if i % 2 == 1:
		odd += dad
		odd -= A[i]
		dad = A[i]
	else:
		even += dad
		even -= A[i]
		dad = A[i]
	if odd == even:
		cnt += 1
print(cnt)


n = int(input())
l = list(map(int, input().split()))
if n == 1:
	print(1)
	exit()
arr = []
li = []
k = j = 0
arr.append(l[0])
li.append(l[1])
for i in range(2, n):
	if i % 2 == 0:
		arr.append(l[i] + arr[-1])
	else:
		li.append(l[i] + li[-1])
count = 0
for i in range(n):
	if i % 2 == 0:
		if i == 0:
			temp = li[-1]
		else:
			temp = arr[(i - 1) // 2] + li[-1] - li[(i - 1) // 2]
		if i == 0:
			val = arr[-1] - arr[0]
		elif i < n:
			val = li[(i - 1) // 2] + arr[-1] - arr[i // 2]
		else:
			val = li[(i - 1) // 2] + arr[-1] - arr[(i - 1) // 2]
		if temp == val:
			count += 1
	else:
		temp = arr[i // 2] + li[-1] - li[(i - 1) // 2]
		if i >= 3:
			val = li[(i - 2) // 2] + arr[-1] - arr[i // 2]
		else:
			val = arr[-1] - arr[0]
		if val == temp:
			count += 1
print(count)


n = int(input())
sweets = list(map(int, input().split()))
par = 0
nepar = 0
s = [0] * n
for i in range(n):
	if i % 2 == 0:
		s[i] = par
		par += sweets[i]
	else:
		s[i] = nepar
		nepar += sweets[i]
s.append(n)
res = 0
for i in range(n - 1):
	if i % 2 == 0:
		new_par = s[i] + nepar - s[i + 1]
		if new_par == par + nepar - new_par - sweets[i]:
			res += 1
	else:
		new_nepar = s[i] + par - s[i + 1]
		if new_nepar == par + nepar - new_nepar - sweets[i]:
			res += 1
if n % 2 == 0:
	if nepar - sweets[-1] == par:
		res += 1
elif par - sweets[-1] == nepar:
	res += 1
print(res)


n = int(input())
L = [int(x) for x in input().split()]
Pe = [0]
Po = [0]
for i in range(n):
	if i % 2 == 1:
		Pe.append(Pe[-1] + L[i])
		Po.append(Po[-1])
	else:
		Po.append(Po[-1] + L[i])
		Pe.append(Pe[-1])
Po.append(0)
Pe.append(0)
s = 0
for i in range(n):
	if Pe[i] + Po[-2] - Po[i + 1] == Po[i] + Pe[-2] - Pe[i + 1]:
		s += 1
print(s)


import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
t = int(input())
b = list(map(int, input().split()))
e = 0
s = 0
for j in range(t):
	if j % 2 == 0:
		e += b[j]
	else:
		s += b[j]
j = 0
c = 0
p = 0
q = 0
while j < t:
	if j % 2 == 0:
		e += -b[j]
		if e + q == s + p:
			c += 1
		p += b[j]
	else:
		s += -b[j]
		if e + q == s + p:
			c += 1
		q += b[j]
	j += 1
print(c)


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
acc1 = [0]
acc2 = [0]
for i in range(n):
	if i % 2 == 0:
		acc1.append(acc1[-1] + a[i])
		acc2.append(acc2[-1])
	else:
		acc1.append(acc1[-1])
		acc2.append(acc2[-1] + a[i])
ans = 0
for i in range(n):
	even = acc1[i] + acc2[n] - acc2[i + 1]
	odd = acc2[i] + acc1[n] - acc1[i + 1]
	if even == odd:
		ans += 1
print(ans)


from sys import stdin, stdout

def main():
	n = int(stdin.readline())
	arr = [int(k) for k in stdin.readline().split()]
	count = 0
	even = 0
	odd = 0
	for i in range(n):
		if i % 2 == 0:
			even += arr[i]
		else:
			odd += arr[i]
	tempe = 0
	tempo = 0
	for i in range(n):
		(res1, res2) = (0, 0)
		if i % 2 == 0:
			res1 = even - arr[i] - tempe + tempo
			res2 = odd - tempo + tempe
			tempe += arr[i]
		else:
			res1 = odd - arr[i] - tempo + tempe
			res2 = even - tempe + tempo
			tempo += arr[i]
		if res1 == res2:
			count += 1
	print(count)
main()


n = int(input())
A = list(map(int, input().split()))
sume = 0
sumo = 0
for i in range(n):
	if i & 1:
		sume += A[i]
	else:
		sumo += A[i]
nowe = 0
nowo = 0
ans = 0
for i in range(n):
	if i & 1:
		nowe += A[i]
		a = sume - nowe
		b = sumo - nowo
		nowe -= A[i]
		if nowe + b == nowo + a:
			ans += 1
		nowe += A[i]
	else:
		nowo += A[i]
		a = sume - nowe
		b = sumo - nowo
		nowo -= A[i]
		if nowe + b == nowo + a:
			ans += 1
		nowo += A[i]
print(ans)


n = int(input())
A = list(map(int, input().split()))
ans = 0
count0 = 0
count1 = 0
count2 = 0
count3 = 0
for i in range(n):
	if i % 2 == 0:
		count0 += A[i]
	else:
		count1 += A[i]
count0 -= A[0]
if count0 + count3 == count1 + count2:
	ans += 1
for i in range(1, n):
	if (i - 1) % 2 == 0:
		count2 += A[i - 1]
	else:
		count3 += A[i - 1]
	if i % 2 == 0:
		count0 -= A[i]
	else:
		count1 -= A[i]
	if count0 + count3 == count1 + count2:
		ans += 1
print(ans)


n = int(input())
a = [int(k) for k in input().split()]
oddsum = 0
evensum = 0
s = sum(a)
dp = []
for i in range(n):
	if i % 2:
		oddsum += a[i]
	else:
		evensum += a[i]
	dp.append([oddsum, evensum])
ans = 0
for i in range(n):
	if i == 0:
		beforeodd = 0
	else:
		beforeodd = dp[i - 1][0]
	if i == n - 1:
		aftereven = 0
	else:
		aftereven = dp[n - 1][1] - dp[i][1]
	if s - a[i] - beforeodd - aftereven == beforeodd + aftereven:
		ans += 1
print(ans)


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
odd_sum = [0] * (n + 1)
even_sum = [0] * (n + 1)
for i in range(len(a)):
	if i % 2 == 0:
		odd_sum[i + 1] = odd_sum[i] + a[i]
		even_sum[i + 1] = even_sum[i]
	else:
		odd_sum[i + 1] = odd_sum[i]
		even_sum[i + 1] = even_sum[i] + a[i]
ans = 0
for i in range(len(a)):
	if odd_sum[i] + (even_sum[-1] - even_sum[i + 1]) == even_sum[i] + (odd_sum[-1] - odd_sum[i + 1]):
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
total = sum(a)
odd_sum = sum([a[i] for i in range(n) if i % 2 != 0])
even_sum = 0
count = 0
for i in range(n):
	if i % 2 == 0:
		even_sum = total - odd_sum - a[i]
	else:
		odd_sum = total - even_sum - a[i]
	if odd_sum == even_sum:
		count += 1
print(count)


n = int(input())
a = [int(x) for x in input().split()]
z = 0
o = 0
e = 0
for i in range(n):
	if i % 2 == 0:
		o = o + a[i]
	else:
		e = e + a[i]
s = 0
p = 0
for i in range(n):
	if i % 2 == 0:
		if o - a[i] - s + p == e + s - p:
			z = z + 1
		s = s + a[i]
	else:
		if e - a[i] + s - p == p + o - s:
			z = z + 1
		p = p + a[i]
print(z)


from sys import stdin, stdout
from collections import Counter
n = [int(x) for x in stdin.readline().rstrip().split()][0]
a = [int(x) for x in stdin.readline().rstrip().split()]
odds = [0]
evens = [0]
odd = 0
even = 0
for i in range(1, n + 1):
	if i % 2 == 0:
		even += a[i - 1]
	else:
		odd += a[i - 1]
	evens.append(even)
	odds.append(odd)
goods = 0
for i in range(1, n + 1):
	even = evens[i - 1] + (odds[n] - odds[i])
	odd = odds[i - 1] + (evens[n] - evens[i])
	if even == odd:
		goods += 1
print(goods)


from sys import stdin

def main():
	q = int(stdin.readline().strip())
	nums = [int(x) for x in stdin.readline().strip().split()]
	sums = [(0, 0)]
	for i in range(len(nums)):
		if i % 2 == 0:
			sums.append((sums[i][0] + nums[i], sums[i][1]))
		else:
			sums.append((sums[i][0], sums[i][1] + nums[i]))
	total = 0
	for i in range(1, len(sums)):
		if sums[i - 1][0] + (sums[len(sums) - 1][1] - sums[i][1]) == sums[i - 1][1] + (sums[len(sums) - 1][0] - sums[i][0]):
			total += 1
	print(total)
main()


n = int(input())
arr = [int(x) for x in input().split()]
evens = [0]
odds = [0]
for i in range(len(arr)):
	if i % 2 == 0:
		evens.append(evens[-1] + arr[i])
	else:
		odds.append(odds[-1] + arr[i])
evens += [evens[-1]]
odds += [odds[-1]]
cnt = 0
for i in range(len(arr)):
	if i % 2 == 0:
		if evens[i // 2] + (odds[-1] - odds[i // 2]) == odds[i // 2] + (evens[-1] - evens[i // 2 + 1]):
			cnt += 1
	elif evens[i // 2 + 1] + (odds[-1] - odds[i // 2 + 1]) == odds[i // 2] + (evens[-1] - evens[i // 2 + 1]):
		cnt += 1
print(cnt)


__author__ = 'NIORLYS'
n = int(input())
candies_w = list(map(int, input().split()))
odd_sum = even_sum = w_sum = goods = 0
for i in range(n):
	even_sum += candies_w[i] * ((i + 1) % 2)
	odd_sum += candies_w[i] * (i % 2)
	w_sum += candies_w[i]
temp_odd_sum = temp_even_sum = 0
for i in range(n):
	temp_odd_sum += candies_w[i] * (i % 2)
	temp_even_sum += candies_w[i] * ((i + 1) % 2)
	if not i % 2 and even_sum - temp_even_sum + temp_odd_sum == (w_sum - candies_w[i]) / 2:
		goods += 1
	elif i % 2 and even_sum - temp_even_sum + temp_odd_sum - candies_w[i] == (w_sum - candies_w[i]) / 2:
		goods += 1
print(goods)


n = int(input())
a = list(map(int, input().split()))
s = 0
o_g = 0
e_g = 0
for i in range(len(a)):
	if i % 2 == 1:
		o_g += a[i]
	else:
		e_g += a[i]
o_c = 0
e_c = 0
for i in range(len(a)):
	if i % 2 == 1:
		o_g -= a[i]
	else:
		e_g -= a[i]
	if o_c + e_g == e_c + o_g:
		s += 1
	if i % 2 == 1:
		o_c += a[i]
	else:
		e_c += a[i]
print(s)


n = int(input(''))
a = list(map(int, input().split()))
b = 0
c = 0
d = 0
e = 0
l = 0
for i in range(0, n):
	if i % 2 == 0:
		b += a[i]
	else:
		c += a[i]
for i in range(0, n):
	if i % 2 == 0:
		f = d + c - e
		g = e + b - d - a[i]
		if f == g:
			l += 1
	else:
		f = e + b - d
		g = d + c - e - a[i]
		if f == g:
			l += 1
	if i % 2 == 0:
		d += a[i]
	else:
		e += a[i]
print(l)


def mysum(store, f):
	r = 0
	idx = f
	N = len(store)
	while idx < N:
		r += store[idx]
		idx += 2
	return r
n = int(input())
store = list(map(int, input().split()))
if n == 1:
	print('1')
	exit()
cnt = 0
A = mysum(store, 0)
B = mysum(store, 1)
A = A - store[0]
if A == B:
	cnt = 1
else:
	cnt = 0
idx = 1
N = len(store)
while idx < N:
	if idx % 2 == 0:
		A -= store[idx]
		A += store[idx - 1]
	else:
		B -= store[idx]
		B += store[idx - 1]
	if A == B:
		cnt += 1
	idx += 1
print(cnt)


n = int(input())
c = [*map(int, input().split())]
a = sum((c[i] for i in range(0, n, 2)))
b = sum((c[i] for i in range(1, n, 2)))
s = 0
a = a - c[0]
if a == b:
	s += 1
for i in range(1, n):
	if i % 2 == 0:
		a = a - c[i] + c[i - 1]
	else:
		b = b - c[i] + c[i - 1]
	if a == b:
		s += 1
print(s)


n = int(input())
a = [int(x) for x in input().split()]
evenPref = evenSuf = oddPref = oddSuf = ans = 0
for i in range(n):
	if i % 2 == 0:
		evenSuf += a[i]
	else:
		oddSuf += a[i]
for i in range(n):
	if i % 2 == 0:
		evenSuf -= a[i]
	else:
		oddSuf -= a[i]
	if evenSuf + oddPref == evenPref + oddSuf:
		ans += 1
	if i % 2 == 0:
		evenPref += a[i]
	else:
		oddPref += a[i]
print(ans)


n = int(input())
kon = [int(x) for x in input().split()]
h = n = 0
i = 1
for item in kon:
	if i % 2 == 0:
		h += item
	else:
		n += item
	i += 1
n1 = h1 = 0
counter = 0
k = 1
for item in kon:
	if k % 2 == 0:
		i = h - h1 - item + n1
		j = n - n1 + h1
		h1 += item
	else:
		i = h - h1 + n1
		j = n - n1 + h1 - item
		n1 += item
	if i == j:
		counter += 1
	k += 1
print(counter)


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	n = int(input())
	arr = list_input()
	even = [0] * (n // 2 + 1)
	odd = [0] * (n // 2 + 1)
	if n % 2 != 0:
		even.append(0)
	i = n - 1
	indx_o = len(odd) - 2
	indx_e = len(even) - 2
	while i >= 0:
		if i % 2 == 0:
			if indx_e == len(even) - 2:
				even[indx_e] = arr[i]
			else:
				even[indx_e] = arr[i] + even[indx_e + 1]
			indx_e -= 1
		else:
			if indx_o == len(odd) - 2:
				odd[indx_o] = arr[i]
			else:
				odd[indx_o] = arr[i] + odd[indx_o + 1]
			indx_o -= 1
		i -= 1
	count = 0
	if even[1] == odd[0]:
		count += 1
	indx_o = 0
	indx_e = 0
	temp_e = arr[0]
	temp_o = 0
	for i in range(1, n):
		if i % 2 != 0:
			if temp_e + odd[indx_o + 1] == temp_o + even[indx_e + 1]:
				count += 1
			temp_o += arr[i]
			indx_e += 1
		else:
			if temp_o + even[indx_e + 1] == temp_e + odd[indx_o + 1]:
				count += 1
			temp_e += arr[i]
			indx_o += 1
	print(count)
t = 1
for _ in range(t):
	solve()


import math
n = int(input())
arr = list(map(int, input().split()))
if n == 1:
	print(1)
	exit()
even = [0] * n
odd = [0] * n
even[0] = 0
odd[0] = arr[0]
a = 1
b = 1
for i in range(1, n):
	if i % 2 == 0:
		odd[a] = arr[i] + odd[a - 1]
		even[b] = even[b - 1]
	else:
		even[b] = arr[i] + even[b - 1]
		odd[a] = odd[a - 1]
	a += 1
	b += 1
ans = 0
for i in range(n):
	xx = 0
	if i > 0:
		xx += odd[i - 1]
	xx += even[n - 1] - even[i]
	yy = 0
	if i > 0:
		yy += even[i - 1]
	yy += odd[n - 1] - odd[i]
	if xx == yy:
		ans += 1
print(ans)


def main():
	n = int(input())
	candy = list(map(int, input().split()))
	odd = 0
	even = 0
	for i in range(1, n + 1):
		if i % 2 != 0:
			odd += candy[i - 1]
		else:
			even += candy[i - 1]
	prev_odd = 0
	prev_even = 0
	good = 0
	for i in range(1, n + 1):
		curr_odd = odd
		curr_even = even
		if i % 2 != 0:
			prev_odd += candy[i - 1]
		else:
			prev_even += candy[i - 1]
		curr_even -= prev_even
		curr_odd -= prev_odd
		if i % 2 != 0:
			curr_even += prev_odd - candy[i - 1]
			curr_odd += prev_even
		else:
			curr_odd += prev_even - candy[i - 1]
			curr_even += prev_odd
		if curr_odd == curr_even:
			good += 1
	print(good)
main()


import sys

def main(n, line):
	even_sum = 0
	odd_sum = 0
	count = 0
	for i in range(n):
		if i % 2 == 0:
			even_sum += line[i]
		else:
			odd_sum += line[i]
	even_p_sum = 0
	odd_p_sum = 0
	for i in range(n):
		if i % 2 == 0:
			if even_p_sum + odd_sum - odd_p_sum == odd_p_sum + even_sum - even_p_sum - line[i]:
				count += 1
			even_p_sum += line[i]
		else:
			if even_p_sum + odd_sum - odd_p_sum - line[i] == odd_p_sum + even_sum - even_p_sum:
				count += 1
			odd_p_sum += line[i]
	return count
first = True
for line in sys.stdin:
	if first:
		first = False
		n = int(line.strip())
		continue
	l = [int(x) for x in line.strip().split(' ')]
	print(main(n, l))


n = int(input())
a = [int(s) for s in input().split()]
a = [0] + a + [0]
goodMoments = 0
F = [[0, 0] for s in range(n + 2)]
G = [[0, 0] for s in range(n + 2)]
for i in range(1, len(a) - 1):
	if i % 2 == 0:
		F[i][1] = F[i - 1][1] + a[i - 1]
		F[i][0] = F[i - 1][0]
	else:
		F[i][0] = F[i - 1][0] + a[i - 1]
		F[i][1] = F[i - 1][1]
for i in range(len(a) - 2, 0, -1):
	if i % 2 == 0:
		G[i][1] = G[i + 1][1] + a[i + 1]
		G[i][0] = G[i + 1][0]
	else:
		G[i][0] = G[i + 1][0] + a[i + 1]
		G[i][1] = G[i + 1][1]
for i in range(1, len(a) - 1):
	F[i][0] += G[i][1]
	F[i][1] += G[i][0]
	if F[i][0] == F[i][1]:
		goodMoments += 1
print(goodMoments)


n = int(input())
a = list(map(int, input().split()))
o = []
e = []
oc = 0
ec = 0
for i in range(n):
	if i % 2 == 0:
		ec += a[i]
	else:
		oc += a[i]
	o.append(oc)
	e.append(ec)
c = 0
for i in range(n):
	if i % 2 == 0:
		oc = o[i] + e[-1] - e[i]
		ec = e[i] - a[i] + o[-1] - o[i]
	else:
		oc = o[i] - a[i] + e[-1] - e[i]
		ec = e[i] + o[-1] - o[i]
	if ec == oc:
		c += 1
print(c)


q = int(input())
weight = list(map(int, input().split()))
wynik = 0
par = 0
npar = 0
for i in range(1, q):
	if i % 2 == 0:
		par = par + weight[i]
	if i % 2 == 1:
		npar = npar + weight[i]
for i in range(1, q):
	if par == npar:
		wynik += 1
	if i % 2 == 0:
		par = par
		npar = npar + weight[i] - weight[i - 1]
	if i % 2 == 1:
		npar = npar
		par = par + weight[i] - weight[i - 1]
if par == npar:
	wynik += 1
print(wynik)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n,) = I()
l = I()
even = [0] * (n + 1)
odd = [0] * (n + 1)
even = [0] + even
odd = [0] + odd
for i in range(n - 1, -1, -1):
	odd[i] += odd[i + 1]
	even[i] += even[i + 1]
	if (i + 1) % 2:
		odd[i] += l[i]
	else:
		even[i] += l[i]
ans = 0
os = 0
es = 0
for i in range(n):
	if (i + 1) % 2:
		if os + even[i] == es + odd[i + 1]:
			ans += 1
	elif os + even[i + 1] == es + odd[i]:
		ans += 1
	if (i + 1) % 2:
		os += l[i]
	else:
		es += l[i]
print(ans)


n = int(input())
ls = list(map(int, input().split()))
odd = even = 0
for i in range(n):
	if i % 2:
		even += ls[i]
	else:
		odd += ls[i]
first = [0, 0]
last = []
for i in range(n):
	first.append(first[-2] + ls[i])
first = first[2:]
for i in range(n):
	if i % 2:
		last.append(even - first[i] + ls[i])
	else:
		last.append(odd - first[i] + ls[i])
cnt = 0
if n == 1:
	print(1)
elif n == 2:
	print(0)
elif n == 3:
	if ls[0] == ls[1] == ls[2]:
		print(3)
	elif ls[0] == ls[1] or ls[0] == ls[2] or ls[1] == ls[2]:
		print(1)
else:
	for i in range(n):
		if i == 0:
			if last[1] == last[2]:
				cnt += 1
		elif i == 1:
			if ls[0] + last[3] == last[2]:
				cnt += 1
		elif i == n - 1:
			if first[n - 2] == first[n - 3]:
				cnt += 1
		elif i == n - 2:
			if first[n - 4] + ls[n - 1] == first[n - 3]:
				cnt += 1
		elif first[i - 2] + last[i + 1] == first[i - 1] + last[i + 2]:
			cnt += 1
	print(cnt)


n = int(input())
l = [0] + list(map(int, input().split()))
pr = [[0, 0]]
mus1 = 0
mus2 = 0
for i in range(1, len(l)):
	if i % 2 == 1:
		mus1 += l[i]
		pr.append([pr[i - 1][0] + l[i], pr[i - 1][1]])
	else:
		mus2 += l[i]
		pr.append([pr[i - 1][0], pr[i - 1][1] + l[i]])
ans = 0
for i in range(1, len(l)):
	if pr[i - 1][0] + pr[n][1] - pr[i][1] == pr[i - 1][1] + pr[n][0] - pr[i][0]:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
chal = 0
nchal = 0
for i in range(n):
	if i % 2 == 0:
		nchal += a[i]
	else:
		chal += a[i]
chpref = 0
nchpref = 0
nchsuf = nchal
chsuf = chal
cou = 0
for i in range(n):
	if i % 2 == 0:
		papa = a[i]
		c = nchpref + chsuf
		b = chpref + nchsuf - papa
		if c == b:
			cou += 1
		nchpref += papa
		nchsuf = nchal - nchpref
	else:
		papa = a[i]
		c = nchpref + chsuf - papa
		b = chpref + nchsuf
		if c == b:
			cou += 1
		chpref += papa
		chsuf = chal - chpref
print(cou)


n = int(input())
li = [int(x) for x in input().split()]
evs = 0
ods = 0
for i in range(1, n):
	if (i + 1) % 2 == 0:
		ods = ods + li[i]
	else:
		evs = evs + li[i]
count = 0
if evs == ods:
	count = count + 1
for i in range(1, n):
	if (i + 1) % 2 == 0:
		ods = ods - li[i] + li[i - 1]
	else:
		evs = evs - li[i] + li[i - 1]
	if evs == ods:
		count = count + 1
print(count)


n = int(input())
a = list(map(int, input().split()))
po = pe = so = se = count = 0
for i in range(0, n, 2):
	so += a[i]
	if i != n - 1:
		se += a[i + 1]
for i in range(n):
	if i & 1:
		se -= a[i]
	else:
		so -= a[i]
	if po + se == pe + so:
		count += 1
	if i & 1:
		pe += a[i]
	else:
		po += a[i]
print(count)


n = int(input())
a = list(map(int, input().split()))
ps0 = [0]
ps1 = [0]
for i in a[0::2]:
	ps0.append(ps0[-1] + i)
for i in a[1::2]:
	ps1.append(ps1[-1] + i)
cnt = 0
for i in range(n):
	sm0 = ps0[(i + 1) // 2] + ps1[-1] - ps1[(i + 1) // 2]
	sm1 = ps1[i // 2] + ps0[-1] - ps0[i // 2 + 1]
	if sm0 == sm1:
		cnt += 1
print(cnt)


n = int(input())
a = list(map(int, input().split()))
ans = 0
sums = [0] * n
if n > 1:
	for i in range(n):
		sums[i] = sums[i - 2] + a[i]
	if n % 2 == 0:
		for i in range(n):
			if i >= 2:
				if sums[i - 1] + sums[n - 2] - sums[i] == sums[i - 2] + sums[n - 1] - sums[i - 1] and i % 2 == 0:
					ans += 1
				if sums[i - 1] + sums[n - 1] - sums[i] == sums[i - 2] + sums[n - 2] - sums[i - 1] and i % 2 == 1:
					ans += 1
			else:
				if sums[n - 2] - sums[i] == sums[n - 1] and i % 2 == 0:
					ans += 1
				if sums[i - 1] + sums[n - 1] - sums[i] == sums[n - 2] - sums[i - 1] and i % 2 == 1:
					ans += 1
	else:
		for i in range(n):
			if i >= 2:
				if sums[i - 1] + sums[n - 1] - sums[i] == sums[i - 2] + sums[n - 2] - sums[i - 1] and i % 2 == 0:
					ans += 1
				if sums[i - 1] + sums[n - 2] - sums[i] == sums[i - 2] + sums[n - 1] - sums[i - 1] and i % 2 == 1:
					ans += 1
			else:
				if sums[n - 1] - sums[i] == sums[n - 2] and i % 2 == 0:
					ans += 1
				if sums[i - 1] + sums[n - 2] - sums[i] == sums[n - 1] - sums[i - 1] and i % 2 == 1:
					ans += 1
else:
	ans = 1
print(ans)


n = int(input())
a = list(map(int, input().split(' ')))
ePref = 0
oPref = 0
eSuf = 0
oSuf = 0
for i in range(0, n):
	if i & 1:
		eSuf += a[i]
	else:
		oSuf += a[i]
ans = 0
for i in range(0, n):
	if i & 1:
		eSuf -= a[i]
	else:
		oSuf -= a[i]
	if ePref + oSuf == oPref + eSuf:
		ans += 1
	if i & 1:
		ePref += a[i]
	else:
		oPref += a[i]
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
x = sum(a)
if n == 1:
	print(1)
	exit()
ind = 0
b = []
b2 = []
d = a[0]
d1 = a[1]
b.append(d)
b2.append(d1)
for i in range(2, n):
	if i % 2 == 0:
		d += a[i]
		b.append(d)
	else:
		d1 += a[i]
		b2.append(d1)
ans = 0
for i in range(n):
	if i == 0:
		s1 = b2[len(b2) - 1]
		s2 = x - s1 - a[0]
		if s1 == s2:
			ans += 1
	elif i != 0 and i != n - 1:
		if i % 2 == 0:
			s1 = b[i // 2] + b2[len(b2) - 1] - a[i] - b2[i // 2 - 1]
			s2 = x - s1 - a[i]
			if s1 == s2:
				ans += 1
		else:
			s1 = b[i // 2] + b2[len(b2) - 1] - b2[i // 2]
			s2 = x - s1 - a[i]
			if s1 == s2:
				ans += 1
	else:
		s1 = 0
		s2 = 0
		for i in range(n - 1):
			if i % 2 == 0:
				s1 += a[i]
			else:
				s2 += a[i]
		if s1 == s2:
			ans += 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
count = 0
(even, odd, e, o) = (0, 0, 0, 0)
for i in range(n):
	if i % 2 == 0:
		even += l[i]
	else:
		odd += l[i]
for i in range(n):
	if i % 2 == 0:
		even -= l[i]
	else:
		odd -= l[i]
	if e + odd == o + even:
		count += 1
	if i % 2 == 0:
		e += l[i]
	else:
		o += l[i]
print(count)


def get_sum(A):
	odd = 0
	even = 0
	for i in range(1, len(A)):
		if i % 2 == 1:
			odd = odd + A[i]
		else:
			even = even + A[i]
	return (odd, even)

def process(A, n):
	(odd, odd1, even, even1) = (0, 0, 0, 0)
	for i in range(1, len(A)):
		if i % 2 == 1:
			odd = odd + A[i]
		else:
			even = even + A[i]
	res = 0
	for i in range(1, len(A)):
		if i % 2 == 1:
			odd = odd - A[i]
		else:
			even = even - A[i]
		if even1 + odd == odd1 + even:
			res = res + 1
		if i % 2 == 1:
			odd1 = odd1 + A[i]
		else:
			even1 = even1 + A[i]
	return res
n = int(input())
A = [None]
for x in input().split():
	A.append(int(x))
print(process(A, n))


n = int(input())
arr = list(map(int, input().split()))
arr1 = []
arr2 = []
count1 = 0
count2 = 0
for i in range(n):
	if i % 2 == 0:
		count1 += arr[i]
	else:
		count2 += arr[i]
ans = 0
temp1 = 0
temp2 = 0
for i in range(n):
	if i % 2 == 0:
		val1 = temp1 + count2 - temp2
		val2 = temp2 + count1 - temp1 - arr[i]
		if val1 == val2:
			ans += 1
		temp1 += arr[i]
	else:
		val1 = temp1 + count2 - temp2 - arr[i]
		val2 = temp2 + count1 - temp1
		if val1 == val2:
			ans += 1
		temp2 += arr[i]
print(ans)


n = int(input())
l = input().split()
l = list(map(int, l))
s = sum(l)
co = 0
q1 = 0
q2 = 0
for i in range(n):
	if i % 2:
		q1 = q1 + l[i]
	else:
		q2 = q2 + l[i]
if q2 - l[0] == q1:
	co = co + 1
s1 = l[0]
s1_ = q2 - s1
s2 = 0
s2_ = q1
for i in range(1, n):
	if i % 2 == 0:
		s1 += l[i]
		s1_ = q2 - s1
		if s1 + s2_ - l[i] == s1_ + s2:
			co = co + 1
	else:
		s2 += l[i]
		s2_ = q1 - s2
		if s2 + s1_ - l[i] == s1 + s2_:
			co = co + 1
print(co)


n = int(input())
a = ['a'] + [int(j) for j in input().split()]
even = 0
odd = 0
for i in range(1, n + 1):
	if i % 2 == 0:
		even += a[i]
	else:
		odd += a[i]
count = 0
even2 = 0
odd2 = 0
x = even
y = odd
for i in range(1, n + 1):
	if i % 2 == 0:
		x -= a[i]
	else:
		y -= a[i]
	if even2 + y == odd2 + x:
		count += 1
	if i % 2 == 0:
		even2 += a[i]
	else:
		odd2 += a[i]
print(count)


import sys
from collections import defaultdict
import heapq
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
n = int(input())
arr = intInp()
evenPre = 0
oddPre = 0
evenSuf = 0
oddSuf = 0
for i in range(n):
	if i % 2 == 0:
		oddSuf += arr[i]
	else:
		evenSuf += arr[i]
good = 0
for i in range(n):
	if i % 2 == 0:
		oddSuf -= arr[i]
	else:
		evenSuf -= arr[i]
	if evenSuf + oddPre == evenPre + oddSuf:
		good += 1
	if i % 2 == 0:
		oddPre += arr[i]
	else:
		oddSuf += arr[i]
print(good)


n = int(input())
a = list(map(int, input().split()))
pr = [[0, 0]]
a1 = 0
a2 = 0
for i in range(n):
	if i % 2:
		a2 += a[i]
	else:
		a1 += a[i]
	pr.append([a1, a2])
c = 0
fa = pr[n]
for i in range(n):
	if i % 2 == 0:
		if pr[i][1] + (fa[0] - pr[i][0] - a[i]) == pr[i][0] + (fa[1] - pr[i][1]):
			c += 1
	elif pr[i][1] + (fa[0] - pr[i][0]) == pr[i][0] + (fa[1] - pr[i][1] - a[i]):
		c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
o = e = oo = ee = ox = ex = c = 0
for i in range(0, n):
	if i % 2 == 0:
		e += a[i]
	else:
		o += a[i]
for i in range(0, n):
	if i % 2 == 0:
		ee += a[i]
		ex = o - a[i] + ee - oo
		ox = e - ee + oo
	else:
		oo += a[i]
		ex = o - oo + ee
		ox = e - a[i] - ee + oo
	if ex == ox:
		c += 1
print(c)


from sys import stdin, stdout
inp = lambda : (int(o) for o in stdin.readline().split())
sinp = lambda : (o for o in stdin.readline().split())
out = lambda : stdout.write(str(an) + '\n')
I = lambda : map(int, input().split())
Y = lambda : int(input())
n = Y()
a = list(I())
b = [[0, 0]]
c1 = c2 = 0
for i in range(n):
	if i % 2:
		c1 += a[i]
	else:
		c2 += a[i]
	b.append([c1, c2])
an = 0
for i in range(n):
	if i % 2:
		c21 = b[i][1]
		c11 = b[i][0]
		c2 = b[-1][0] - c11 + c21 - a[i]
		c1 = b[-1][1] - c21 + c11
	else:
		c21 = b[i][1]
		c11 = b[i][0]
		c2 = b[-1][0] - c11 + c21
		c1 = b[-1][1] - c21 + c11 - a[i]
	if c1 == c2:
		an += 1
out()


n = int(input())
l = list(map(int, input().split()))
odd = 0
even = 0
for i in range(n):
	if i % 2 == 0:
		odd += l[i]
	else:
		even += l[i]
(c, od, ev) = (0, 0, 0)
for i in range(n):
	if i % 2 == 0:
		od += l[i]
		if od - l[i] + even - ev == ev + odd - od:
			c += 1
	else:
		ev += l[i]
		if ev - l[i] + odd - od == od + even - ev:
			c += 1
print(c)


n = int(input())
l = list(map(int, input().split()))
oddpre = 0
evenpre = 0
evensuff = 0
oddsuff = 0
for i in range(n):
	if i % 2 == 0:
		evensuff += l[i]
	else:
		oddsuff += l[i]
ans = 0
for i in range(n):
	if i % 2 == 0:
		evensuff -= l[i]
	else:
		oddsuff -= l[i]
	if oddpre + evensuff == oddsuff + evenpre:
		ans += 1
	if i % 2 == 0:
		evenpre += l[i]
	else:
		oddpre += l[i]
print(ans)


num = int(input())
data = list(map(int, input().split()))
asum = [data[0]]
for i in range(1, num):
	if i % 2 == 0:
		asum.append(asum[-1] + data[i])
	else:
		asum.append(asum[-1] - data[i])
mysum = 0
run = 0
for j in range(num - 1, -1, -1):
	if j % 2 == 0:
		run += data[j]
	else:
		run -= data[j]
	if run == asum[j]:
		mysum += 1
print(mysum)


n = int(input())
a = list(map(int, input().split(' ')))
j = 0
leven = 0
lodd = 0
reven = sum(a[2::2])
rodd = sum(a[1::2])
if leven + rodd == lodd + reven:
	j = 1
for i in range(n - 1):
	if i % 2 == 0:
		leven += a[i]
		rodd -= a[i + 1]
	else:
		lodd += a[i]
		reven -= a[i + 1]
	if leven + rodd == lodd + reven:
		j += 1
print(j)


class Solution:

	def __init__(self):
		n = int(input())
		odd = []
		even = []
		odd.append(0)
		even.append(0)
		a = input().split()
		for i in range(n):
			even.append(even[i])
			odd.append(odd[i])
			if i & 1:
				even[i + 1] += int(a[i])
			else:
				odd[i + 1] += int(a[i])
		res = 0
		for i in range(1, n + 1):
			left = even[n] - even[i]
			right = odd[n] - odd[i]
			if left + odd[i - 1] == right + even[i - 1]:
				res += 1
		print(res)
Solution()


cnt = lambda s, i: s.count(i)
ii = lambda : int(input())
si = lambda : input()
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
n = ii()
l = il()
os = sum(l[1::2])
es = sum(l[2::2])
c = int(os == es)
for i in range(2, n + 1):
	if i & 1:
		es += l[i - 2] - l[i - 1]
	else:
		os += l[i - 2] - l[i - 1]
	c += os == es
print(c)


n = int(input())
arr = list(map(int, input().split()))
suff_odd = 0
suff_even = 0
for i in range(n):
	if i % 2 == 0:
		suff_even += arr[i]
	else:
		suff_odd += arr[i]
pref_even = 0
pref_odd = 0
cnt = 0
for i in range(0, n):
	if i % 2 == 0:
		suff_even -= arr[i]
		if suff_odd + pref_even == suff_even + pref_odd:
			cnt += 1
		pref_even += arr[i]
	else:
		suff_odd -= arr[i]
		if suff_odd + pref_even == suff_even + pref_odd:
			cnt += 1
		pref_odd += arr[i]
print(cnt)


n = int(input())
a = [int(i) for i in input().split()]
(ep, op, es, os) = (0, 0, 0, 0)
for i in range(n):
	if i % 2 == 1:
		es += a[i]
	else:
		os += a[i]
ANS = 0
for i in range(n):
	if i % 2 == 1:
		es -= a[i]
	else:
		os -= a[i]
	if ep + os == op + es:
		ANS += 1
	if i % 2 == 1:
		ep += a[i]
	else:
		op += a[i]
print(ANS)


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import *
import functools
import sys
import math
MAX = sys.maxsize
MAXN = 10 ** 6 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN():
	return map(int, sys.stdin.readline().strip().split())

def charIN():
	return sys.stdin.readline().strip().split()

def chk(x, y):
	print(x, '=', y)

def ncr(n, k):
	res = 1
	c = [0] * (k + 1)
	c[0] = 1
	for i in range(1, n + 1):
		for j in range(min(i, k), 0, -1):
			c[j] = (c[j] + c[j - 1]) % MOD
	return c[k]
n = int(input())
l = [0] + list(numIN())
o = [l[i] for i in range(1, n + 1, 2)]
e = [l[i] for i in range(0, n + 1, 2)]
po = list(accumulate(o))
pe = list(accumulate(e))
cnt = 0
su = sum(l)
for i in range(1, n + 1):
	if i % 2:
		es = po[-1] - po[i // 2] + pe[i // 2]
		os = su - es - l[i]
	else:
		os = pe[-1] - pe[i // 2] + po[i // 2 - 1]
		es = su - os - l[i]
	if es == os:
		cnt += 1
print(cnt)


n = int(input())
a = list(map(int, input().split()))
f1 = s1 = f2 = s2 = 0
for i in range(len(a)):
	if i % 2 == 0:
		f2 += a[i]
	else:
		s2 += a[i]
res = 0
z = (n - 1) % 2
for i in range(len(a)):
	if i % 2 == 0:
		f2 -= a[i]
		if f2 + s1 == s2 + f1:
			res += 1
		f1 += a[i]
	else:
		s2 -= a[i]
		if f2 + s1 == s2 + f1:
			res += 1
		s1 += a[i]
print(res)


n = int(input())
candies = list(map(int, input().split()))
num = 0
odd = 0
even = 0
evenPref = 0
oddPref = 0
for i in range(n):
	if not i & 1:
		even += candies[i]
	else:
		odd += candies[i]
for i in range(n):
	if not i & 1:
		even -= candies[i]
	else:
		odd -= candies[i]
	if evenPref + odd == oddPref + even:
		num += 1
	if not i & 1:
		evenPref += candies[i]
	else:
		oddPref += candies[i]
print(num)


import sys
from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
import heapq
mod = 10 ** 9 + 7

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
for _ in range(1):
	n = ri(1)
	a = ri()
	if n == 1:
		print(1)
		break
	if n == 2:
		pass
	ans = 0
	even = [a[0]]
	odd = [0]
	for i in range(1, n):
		if i % 2 == 0:
			even.append(even[-1] + a[i])
			odd.append(odd[-1])
		else:
			odd.append(odd[-1] + a[i])
			even.append(even[-1])
	for i in range(n):
		justeven = 0
		justodd = 0
		if i % 2 == 0:
			justeven = even[i] - a[i] + odd[n - 1] - odd[i]
			justodd = odd[i] + even[n - 1] - even[i]
		else:
			justodd = odd[i] - a[i] + even[n - 1] - even[i]
			justeven = even[i] + odd[n - 1] - odd[i]
		if justodd == justeven:
			ans += 1
	print(ans)


def Num_solution(n, candy):
	Odd_sum = Even_sum = num_solution = 0
	for i in range(len(candy)):
		if i % 2 == 0:
			Odd_sum += candy[i]
		else:
			Even_sum += candy[i]
	Odd_sum_now = Even_sum_now = 0
	for i in range(len(candy)):
		if i % 2 == 0:
			if Odd_sum_now + Even_sum - Even_sum_now == Even_sum_now + (Odd_sum - candy[i]) - Odd_sum_now:
				num_solution += 1
			Odd_sum_now += candy[i]
		else:
			if Odd_sum_now + (Even_sum - candy[i]) - Even_sum_now == Even_sum_now + Odd_sum - Odd_sum_now:
				num_solution += 1
			Even_sum_now += candy[i]
	return num_solution
N = int(input())
Candy = list(map(int, input().split()))
print(Num_solution(N, Candy))


n = int(input())
L = list(map(int, input().strip().split()))
ans = 0
sum_odd = 0
sum_eve = 0
for i in range(n):
	if i % 2 == 0:
		sum_eve += L[i]
	else:
		sum_odd += L[i]
odd_pref = 0
even_pref = 0
for i in range(n):
	if i % 2 == 0:
		sum_eve = sum_eve - L[i]
	else:
		sum_odd = sum_odd - L[i]
	if sum_odd + even_pref == sum_eve + odd_pref:
		ans += 1
	if i % 2 == 0:
		even_pref += L[i]
	else:
		odd_pref += L[i]
print(ans)


n = int(input())
s = list(map(int, input().split()))
ans = 0
sumchet = sum(s[::2])
sumnech = sum(s[1::2])
(s1, s2) = (0, 0)
for i in range(n):
	if i % 2 == 0:
		sumchet -= s[i]
		if sumchet + s1 == sumnech + s2:
			ans += 1
		s2 += s[i]
	else:
		sumnech -= s[i]
		if sumchet + s1 == sumnech + s2:
			ans += 1
		s1 += s[i]
print(ans)


n = int(input())
a = list(map(int, input().split()))
s = sum(a[1::2])
t = sum(a[::2])
(s1, t1, count) = (0, 0, 0)
for i in range(n):
	if i % 2:
		s -= a[i]
	else:
		t -= a[i]
	if s + t1 == t + s1:
		count += 1
	if i % 2:
		s1 += a[i]
	else:
		t1 += a[i]
print(count)


n = int(input())
arr = [int(i) for i in input().split()]
(osum, esum) = (0, 0)
for i in range(1, n, 2):
	osum += arr[i]
for i in range(2, n, 2):
	esum += arr[i]
count = 0
if osum == esum:
	count += 1
for i in range(1, n):
	if i % 2:
		osum -= arr[i]
		osum += arr[i - 1]
	else:
		esum -= arr[i]
		esum += arr[i - 1]
	if osum == esum:
		count += 1
print(count)


n = int(input())
a = [int(i) for i in input().split()]
b = [0]
c = [0]
(s, x) = (0, 0)
for i in range(n):
	if i % 2 == 0:
		s += a[i]
		b.append(s)
	else:
		x += a[i]
		c.append(x)
cnt = 0
for i in range(n):
	if i % 2 == 0:
		x = i // 2
		da = b[x]
		db = c[x]
		pa = b[-1] - b[x + 1]
		pb = c[-1] - c[x]
		if da + pb == db + pa:
			cnt += 1
	else:
		x = i // 2
		da = b[x + 1]
		db = c[x]
		pa = b[-1] - b[x + 1]
		pb = c[-1] - c[x + 1]
		if da + pb == db + pa:
			cnt += 1
print(cnt)


n = int(input())
l = list(map(int, input().split()))
(e1, o1) = (0, 0)
for i in range(n):
	if i % 2 == 0:
		e1 = e1 + l[i]
	else:
		o1 = o1 + l[i]
(e2, o2) = (0, 0)
count = 0
for i in range(n):
	if i % 2 == 0:
		e1 = e1 - l[i]
		if o1 + e2 == e1 + o2:
			count += 1
		e2 = e2 + l[i]
	else:
		o1 = o1 - l[i]
		if o1 + e2 == e1 + o2:
			count += 1
		o2 = o2 + l[i]
print(count)


n = int(input())
a = [int(x) for x in input().split()]
le = len(a)
pref = [0 for x in a]
suf = [0 for x in a]
cumu = 0
for (idx, x) in enumerate(a):
	if idx % 2 == 0:
		cumu += x
	else:
		cumu -= x
	pref[idx] = cumu
idx = le - 1
cumu = 0
while idx >= 0:
	cumu = a[idx] - cumu
	suf[idx] = cumu
	idx -= 1
res = 0
for idx in range(le):
	prefsum = 0 if idx == 0 else pref[idx - 1]
	sufsum = (0 if idx == le - 1 else suf[idx + 1]) * (1 if idx % 2 == 0 else -1)
	if prefsum + sufsum == 0:
		res += 1
print(res)


n = int(input())
a = list(map(int, input().split()))
total_odd = 0
total_even = 0
pref_odd = [0] * n
pref_even = [0] * n
for (i, val) in enumerate(a):
	if i > 0:
		pref_odd[i] += pref_odd[i - 1]
		pref_even[i] += pref_even[i - 1]
	if (i + 1) % 2 == 0:
		total_even += val
		pref_even[i] += val
		if i > 0:
			pref_odd[i] = pref_odd[i - 1]
	else:
		total_odd += val
		pref_odd[i] += val
		if i > 0:
			pref_even[i] = pref_even[i - 1]
res = 0
for (i, val) in enumerate(a):
	if (i + 1) % 2 == 0:
		if pref_even[i] - val + (total_odd - pref_odd[i]) == pref_odd[i] + (total_even - pref_even[i]):
			res += 1
	elif pref_even[i] + (total_odd - pref_odd[i]) == pref_odd[i] - val + (total_even - pref_even[i]):
		res += 1
print(res)


n = int(input())
li = list(map(int, input().split()))
cr = 0
b = 0
sumo = 0
sume = 0
for i in range(n):
	if (i + 1) % 2:
		sumo += li[i]
	else:
		sume += li[i]
cr = 0
smo = 0
sme = 0
for i in range(n - 1, -1, -1):
	x = sumo
	y = sume
	if (i + 1) % 2:
		smo += li[i]
	else:
		sme += li[i]
	a = smo
	b = sme
	if (i + 1) % 2:
		a -= li[i]
	else:
		b -= li[i]
	x = x - a + b
	y = y - b + a
	if (i + 1) % 2:
		x -= li[i]
	else:
		y -= li[i]
	if x == y:
		cr += 1
print(cr)


import sys, collections
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
pf_odd = [0] * n
pf_even = [0] * n
pf_even[0] = arr[0]
for i in range(1, n):
	if i % 2 == 1:
		pf_even[i] = pf_even[i - 1]
	else:
		pf_even[i] = pf_even[i - 1] + arr[i]
for i in range(1, n):
	if i % 2 == 1:
		pf_odd[i] = pf_odd[i - 1] + arr[i]
	else:
		pf_odd[i] = pf_odd[i - 1]
ans = 0
for i in range(n):
	if i % 2 == 0:
		if pf_even[i] - arr[i] + pf_odd[n - 1] - pf_odd[i] == pf_odd[i] + pf_even[n - 1] - pf_even[i]:
			ans += 1
	elif pf_even[i] + pf_odd[n - 1] - pf_odd[i] == pf_odd[i] - arr[i] + pf_even[n - 1] - pf_even[i]:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
if n == 1:
	print(1)
else:
	l = []
	r = []
	for i in range(n):
		if i % 2 == 0:
			l.append(a[i])
		else:
			r.append(a[i])
	tl = [0] * len(l) + [0]
	tr = [0] * len(r) + [0]
	tl[0] = l[0]
	tr[0] = r[0]
	for i in range(1, len(l)):
		tl[i] = tl[i - 1] + l[i]
	for i in range(len(r)):
		tr[i] = tr[i - 1] + r[i]
	cnt = 0
	for i in range(len(r)):
		if tl[i - 1] + (tr[-2] - tr[i - 1]) == tr[i - 1] + (tl[-2] - tl[i]):
			cnt += 1
	if len(l) > len(r) and tl[-3] == tr[-2]:
		cnt += 1
	for i in range(len(r)):
		if i == 1:
			pass
		if tr[i - 1] + (tl[-2] - tl[i]) == tl[i] + (tr[-2] - tr[i]):
			cnt += 1
	print(cnt)


n = int(input())
candy = list(map(int, input().split()))
good = 0
fake = candy.copy()
even = []
for z in range(int(len(candy) / 2 + 0.5)):
	new = fake[2 * z]
	fake[2 * z] = 0
	even.append(new)
sumodd = sum(even[1:])
sumeven = sum(fake)
if sumeven == sumodd:
	good += 1
for i in range(1, len(candy)):
	if i % 2 == 1:
		sumeven += candy[i - 1] - candy[i]
	else:
		sumodd += candy[i - 1] - candy[i]
	if sumodd == sumeven:
		good += 1
print(good)


num = int(input())
weights = [int(x) for x in input().split()]
ans = 0
odd = 0
even = 0
for i in range(1, num):
	if i % 2:
		odd += weights[i]
	else:
		even += weights[i]
if even == odd:
	ans += 1
removed = 1
while removed < num:
	if removed % 2:
		odd -= weights[removed]
		odd += weights[removed - 1]
	else:
		even -= weights[removed]
		even += weights[removed - 1]
	if even == odd:
		ans += 1
	removed += 1
print(ans)


from sys import stdin

def ip():
	return [int(i) for i in stdin.readline().split()]

def sp():
	return [str(i) for i in stdin.readline().split()]

def pp(A):
	for i in A:
		print(i)

def solve():
	n = int(input())
	A = ip()
	(fe, fo) = (0, 0)
	for i in range(n):
		if i % 2 == 0:
			fe += A[i]
		else:
			fo += A[i]
	ans = 0
	(re, ro) = (0, 0)
	for i in range(n):
		(te, to) = (fe, fo)
		if i % 2 == 0:
			te -= A[i]
		else:
			to -= A[i]
		te -= re
		to -= ro
		if te + ro == to + re:
			ans += 1
		if i % 2 == 0:
			re += A[i]
		else:
			ro += A[i]
	return ans
print(solve())


n = int(input())
a = list(map(int, input().split()))
odd_sum = 0
even_sum = 0
for i in range(n):
	if i % 2 == 0:
		even_sum += a[i]
	else:
		odd_sum += a[i]
count = 0
odd_1 = 0
even_1 = 0
for i in range(n):
	if i % 2 == 0:
		even_1 += a[i]
		lame = even_1 - a[i]
		x = odd_sum - odd_1
		x += lame
		y = even_sum - even_1
		y += odd_1
		if x == y:
			count += 1
	else:
		odd_1 += a[i]
		lame = odd_1 - a[i]
		x = even_sum - even_1
		x += lame
		y = odd_sum - odd_1
		y += even_1
		if x == y:
			count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
c = [0]
nch = [0]
for i in range(n):
	if i % 2 == 0:
		nch.append(nch[-1])
		c.append(c[-1] + a[i])
	else:
		nch.append(nch[-1] + a[i])
		c.append(c[-1])
c = c[1:]
nch = nch[1:]
k = 0
for i in range(n):
	x = c[i] + nch[-1] - nch[i]
	y = nch[i] + c[-1] - c[i]
	if i % 2 == 0:
		x -= a[i]
	else:
		y -= a[i]
	if x == y:
		k += 1
print(k)


n = int(input())
arr = list(map(int, input().split()))
even = [0] * ((n + 1) // 2)
odd = [0] * (n // 2)
(j, k) = (0, 0)
for i in range(n):
	if i % 2 == 0:
		even[j] = even[j - 1] + arr[i]
		j += 1
	else:
		odd[k] = odd[k - 1] + arr[i]
		k += 1
ans = 0
if n == 1:
	print(1)
	exit()
if even[-1] - arr[0] == odd[-1]:
	ans += 1
if n % 2 == 0:
	if odd[-1] - arr[n - 1] == even[-1]:
		ans += 1
elif even[-1] - arr[n - 1] == odd[-1]:
	ans += 1
for i in range(1, n - 1, 1):
	if i % 2 == 0:
		if even[(i - 2) // 2] + odd[-1] - odd[(i - 2) // 2] == odd[(i - 2) // 2] + even[-1] - even[i // 2]:
			ans += 1
	elif i - 2 < 0:
		if even[i // 2] + odd[-1] - odd[i // 2] == even[-1] - even[i // 2]:
			ans += 1
	elif even[i // 2] + odd[-1] - odd[i // 2] == odd[(i - 2) // 2] + even[-1] - even[i // 2]:
		ans += 1
print(ans)


n = int(input())
a = [0] + [int(i) for i in input().split()]
cur_even = 0
cur_odd = 0
even = []
odd = []
for i in range(1, n + 1):
	if i % 2 == 1:
		cur_odd += a[i]
	else:
		cur_even += a[i]
	even.append(cur_even)
	odd.append(cur_odd)
cur_even = 0
cur_odd = 0
sufeven = []
sufodd = []
for i in range(n, 0, -1):
	if i % 2 == 1:
		cur_odd += a[i]
	else:
		cur_even += a[i]
	sufeven.append(cur_even)
	sufodd.append(cur_odd)
sufeven = sufeven[::-1]
sufodd = sufodd[::-1]
ans = 0
for i in range(n):
	if sufeven[i] - sufodd[i] == even[i] - odd[i]:
		ans += 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
s = 0
po = 0
pe = 0
se = sum(l[1:][::2])
so = sum(l[::2])
for i in range(n):
	if i % 2 == 0:
		so -= l[i]
		if po + se == pe + so:
			s += 1
		po += l[i]
	else:
		se -= l[i]
		if po + se == pe + so:
			s += 1
		pe += l[i]
print(s)


n = int(input())
a = [int(o) for o in input().split()]
sa = [0] * n
ea = [0] * (n + 3)
oa = [0] * (n + 3)
es = 0
os = 0
for i in range(n):
	if i % 2 == 0:
		es += a[i]
		sa[i] = es
	else:
		os += a[i]
		sa[i] = os
	oa[i] = os
	ea[i] = es
count = 0
for i in range(n):
	if i % 2 == 0:
		if es - ea[i] + oa[i - 1] == os - oa[i - 1] + ea[i - 1]:
			count += 1
	elif os - oa[i] + ea[i - 1] == es - ea[i - 1] + oa[i - 1]:
		count += 1
print(count)


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = sys.stdin.readline().split()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_int(self):
		return int(self.next())

	def solve(self):
		n = self.next_int()
		nums = []
		sums = []
		for i in range(0, n):
			x = self.next_int()
			nums.append(x)
			if i < 2:
				sums.append(x)
			else:
				sums.append(x + sums[i - 2])
		r = 0
		for i in range(0, n):
			s2 = sums[i - 2] if i >= 2 else 0
			s1 = sums[i - 1] if i >= 1 else 0
			if (n - 1 - i) % 2 == 0:
				r1 = 0 if i == n - 1 else sums[n - 1] - s2 - nums[i]
				r2 = 0 if i >= n - 2 else sums[n - 2] - s1
			else:
				r2 = 0 if i == n - 1 else sums[n - 1] - s1
				r1 = 0 if i >= n - 2 else sums[n - 2] - s2 - nums[i]
			if s1 + r1 == s2 + r2:
				r += 1
		print(r)
Main().solve()


n = int(input())
a = [int(x) for x in input().split()]
eve = [0] * n
odd = [a[0]] * n
for i in range(1, n):
	if (i + 1) % 2 == 0:
		eve[i] = eve[i - 1] + a[i]
		odd[i] = odd[i - 1]
	else:
		odd[i] = odd[i - 1] + a[i]
		eve[i] = eve[i - 1]
count = 0
for i in range(n):
	if (i + 1) % 2 == 0:
		o = odd[i] + eve[n - 1] - eve[i]
		e = eve[i] + odd[n - 1] - odd[i] - a[i]
	else:
		o = odd[i] + eve[n - 1] - eve[i] - a[i]
		e = eve[i] + odd[n - 1] - odd[i]
	if e == o:
		count += 1
print(count)


def make_to_left(n, arr):
	flag = True
	ret = [-1] * n
	flag_sum = 0
	not_flag_sum = 0
	for i in range(n - 1, -1, -1):
		if flag:
			flag_sum += arr[i]
			ret[i] = flag_sum
			flag = False
		else:
			not_flag_sum += arr[i]
			ret[i] = not_flag_sum
			flag = True
	return ret

def make_to_right(n, arr):
	flag = True
	ret = [-1] * n
	flag_sum = 0
	not_flag_sum = 0
	for i in range(n):
		if flag:
			flag_sum += arr[i]
			ret[i] = flag_sum
			flag = False
		else:
			not_flag_sum += arr[i]
			ret[i] = not_flag_sum
			flag = True
	return ret

def candies(n, arr):
	to_left = make_to_left(n, arr)
	to_right = make_to_right(n, arr)
	ret = 0
	for i in range(n):
		even = 0
		odd = 0
		if i < n - 1:
			even += to_left[i + 1]
		if i < n - 2:
			odd += to_left[i + 2]
		if i > 1:
			even += to_right[i - 2]
		if i > 0:
			odd += to_right[i - 1]
		if even == odd:
			ret += 1
	return ret
n = int(input())
arr = [int(a) for a in input().split(' ')]
ret = candies(n, arr)
print(ret)


n = int(input())
l = list(map(int, input().split()))
(s, p, k) = (0, 0, 0)
if n % 2 == 0:
	for i in range(0, n, 2):
		s = s + l[i]
		p = p + l[i + 1]
else:
	for i in range(0, n - 1, 2):
		s = s + l[i]
		p = p + l[i + 1]
	s = s + l[-1]
	if s != p:
		l.append(0)
		k = 0
	else:
		l.append(0)
		k = -1
	n = n + 1
(j, y) = (0, 0)
for i in range(0, n, 2):
	if p - j + y == s + j - l[i] - y:
		k = k + 1
	y = l[i] + y
	if s - y + j == p - l[i + 1] + y - j:
		k = k + 1
	j = j + l[i + 1]
print(k)


n = int(input())
a = list(map(int, input().split()))
if n == 1:
	print(1)
else:
	odd_prefix = [0] * n
	even_prefix = [0] * n
	odd = 0
	even = 0
	for i in range(n):
		if i % 2 == 0:
			even += a[i]
		else:
			odd += a[i]
		odd_prefix[i] = odd
		even_prefix[i] = even
	k = 0
	for i in range(n):
		if i == 0:
			if even_prefix[-1] - even_prefix[1] == odd_prefix[-1]:
				k += 1
		elif even_prefix[i - 1] + (odd_prefix[-1] - odd_prefix[i]) == odd_prefix[i - 1] + (even_prefix[-1] - even_prefix[i]):
			k += 1
	print(k)


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
total_odd = 0
total_even = 0
odd = 0
even = 0
count = 0
for i in range(n):
	if (i + 1) % 2 == 0:
		total_even += a[i]
	else:
		total_odd += a[i]
for i in range(n):
	if (i + 1) % 2 == 0:
		even += a[i]
		a1 = odd + (total_even - even)
		a2 = even - a[i] + total_odd - odd
		if a1 == a2:
			count += 1
	else:
		odd += a[i]
		a1 = odd - a[i] + total_even - even
		a2 = even + (total_odd - odd)
		if a1 == a2:
			count += 1
print(count)


from sys import stdin
n = int(stdin.readline().strip())
s = list(map(int, stdin.readline().strip().split()))
even = [0]
odd = [0]
a = 0
b = 0
for i in range(n):
	if i % 2 == 0:
		a += s[i]
	else:
		b += s[i]
	even.append(a)
	odd.append(b)
ans = 0
for i in range(1, n + 1):
	x = even[i - 1] + (odd[-1] - odd[i])
	y = odd[i - 1] + (even[-1] - even[i])
	if x == y:
		ans += 1
print(ans)


n = int(input())
A = list(map(int, input().split()))
E = 0
O = 0
for i in range(1, n):
	if i % 2 == 1:
		E += A[i]
	else:
		O += A[i]
ANS = 0
if E == O:
	ANS += 1
for i in range(1, n):
	if i % 2 == 1:
		E -= A[i]
		E += A[i - 1]
		if E == O:
			ANS += 1
	else:
		O -= A[i]
		O += A[i - 1]
		if E == O:
			ANS += 1
print(ANS)


import sys, math, bisect
inf = float('inf')
mod = 10 ** 9 + 7

def lcm(a, b):
	return int(a / math.gcd(a, b) * b)

def gcd(a, b):
	return int(math.gcd(a, b))

def tobinary(n):
	return bin(n)[2:]

def binarySearch(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def lowerBound(a, x):
	i = bisect.bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def upperBound(a, x):
	i = bisect.bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def primesInRange(n):
	ans = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			ans.append(p)
	return ans

def primeFactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n = n // i
	if n > 2:
		factors.append(n)
	return factors
from collections import deque, defaultdict, Counter
import heapq
for _ in range(1):
	n = int(input())
	arr = list(map(int, input().split()))
	prefo = [0] * n
	prefe = [0] * n
	for i in range(n):
		if i % 2 == 0:
			if i == 0:
				prefe[i] = arr[i]
			else:
				prefe[i] = prefe[i - 1] + arr[i]
		else:
			prefe[i] = prefe[i - 1]
	for i in range(n):
		if i % 2 == 1:
			prefo[i] = prefo[i - 1] + arr[i]
		else:
			prefo[i] = prefo[i - 1]
	ans = 0
	for i in range(n):
		if i > 0:
			odd = prefe[-1] - prefe[i] + prefo[i - 1]
			even = prefo[-1] - prefo[i] + prefe[i - 1]
		else:
			odd = prefe[-1] - prefe[i]
			even = prefo[-1] - prefo[i]
		if odd == even:
			ans += 1
	print(ans)


t = int(input())
lst = list(map(int, input().split()))
o = 0
e = 0
for c in range(t):
	if c % 2 == 0:
		o += lst[c]
	else:
		e += lst[c]
s1 = 0
s2 = 0
l1 = []
l2 = []
for c in range(t):
	if c % 2 == 0:
		l1.append((s1, o - lst[c] - s1))
		l2.append((s2, e - s2))
		s1 += lst[c]
	else:
		l1.append((s1, o - s1))
		l2.append((s2, e - lst[c] - s2))
		s2 += lst[c]
count = 0
for c in range(t):
	if l1[c][0] + l2[c][1] == l1[c][1] + l2[c][0]:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
left = sum(a[::2])
right = sum(a[1::2])
seen_left = 0
seen_right = 0
total = 0
for (i, x) in enumerate(a):
	if i % 2 == 0:
		left -= x
		if seen_left + right == seen_right + left:
			total += 1
		seen_left += x
	else:
		right -= x
		if seen_left + right == left + seen_right:
			total += 1
		seen_right += x
print(total)


n = int(input())
d = [0]
arr = list(map(int, input().split()))
for (i, c) in enumerate(arr):
	if i % 2 == 0:
		d.append(d[-1] + c)
	else:
		d.append(d[-1] - c)
ans = 0
for i in range(1, len(d)):
	if d[i - 1] == d[-1] - d[i]:
		ans += 1
print(ans)


from sys import stdin
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
arr.insert(0, -1)
preodd = [0]
preeven = [0]
postodd = [0]
posteven = [0]
a = 0
b = 0
for i in range(1, n + 1):
	if i % 2 == 0:
		preeven.append(a + arr[i])
		a = preeven[-1]
	else:
		preodd.append(b + arr[i])
		b = preodd[-1]
a = 0
b = 0
for i in range(n, 0, -1):
	if i % 2 == 0:
		posteven.append(a + arr[i])
		a = posteven[-1]
	else:
		postodd.append(b + arr[i])
		b = postodd[-1]
postodd.reverse()
posteven.reverse()
count = 0
for i in range(1, n + 1):
	oddsum = 0
	evensum = 0
	oddsum += preodd[i // 2]
	oddsum += posteven[i // 2]
	evensum += preeven[(i - 1) // 2]
	evensum += postodd[(i + 1) // 2]
	if evensum == oddsum:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
odds = [0 for i in range(n)]
evns = [0 for i in range(n)]
odds[0] = a[0]
evns[0] = 0
summ = a[0]
for i in range(1, n):
	summ += a[i]
	odds[i] = odds[i - 1]
	evns[i] = evns[i - 1]
	if i % 2 == 0:
		odds[i] += a[i]
	else:
		evns[i] += a[i]
counter = 0
for i in range(n):
	if (summ - a[i]) % 2 != 0:
		continue
	nds = (summ - a[i]) // 2
	if i == 0 and evns[n - 1] == nds or (i != 0 and odds[i - 1] + evns[n - 1] - evns[i] == nds):
		counter += 1
print(counter)


n = int(input())
a = list(map(int, input().split()))
even = [a[0]]
odd = [0]
odd_end = [0] * n
even_end = [a[n - 1]] * n
if n == 1:
	print(1)
else:
	for i in range(1, n):
		if i % 2 == 0:
			even.append(even[-1] + a[i])
			odd.append(odd[-1])
		else:
			odd.append(odd[-1] + a[i])
			even.append(even[-1])
	l = 1
	for i in range(n - 2, -1, -1):
		if l % 2 == 0:
			even_end[i] = a[i] + even_end[i + 1]
			odd_end[i] = odd_end[i + 1]
		else:
			odd_end[i] = a[i] + odd_end[i + 1]
			even_end[i] = even_end[i + 1]
		l += 1
	ans = 0
	for i in range(n):
		if n % 2 == 0:
			if i == 0:
				if odd_end[1] == even_end[1]:
					ans += 1
			elif i == n - 1:
				if even[n - 2] == odd[n - 2]:
					ans += 1
			elif even_end[i + 1] + even[i - 1] == odd_end[i + 1] + odd[i - 1]:
				ans += 1
		elif i == 0:
			if odd_end[1] == even_end[1]:
				ans += 1
		elif i == n - 1:
			if even[n - 2] == odd[n - 2]:
				ans += 1
		elif odd_end[i + 1] + even[i - 1] == even_end[i + 1] + odd[i - 1]:
			ans += 1
	print(ans)


n = int(input())
a = list(map(int, input().split()))
b = [[0, 0]]
e = o = 0
for i in range(n):
	if i % 2 == 0:
		o += a[i]
	else:
		e += a[i]
	b.append([e, o])
ans = 0
for i in range(n):
	if i % 2 == 0:
		o1 = b[i][1]
		e1 = b[i][0]
		o = b[-1][0] - e1 + o1
		e = b[-1][1] - a[i] - o1 + e1
	else:
		o1 = b[i][1]
		e1 = b[i][0]
		o = b[-1][0] - e1 + o1 - a[i]
		e = b[-1][1] - o1 + e1
	if o == e:
		ans += 1
print(ans)


from sys import exit
n = int(input())
if n == 1:
	print(1)
	exit()
s = list(map(int, input().split()))
a1 = [0 for i in range(n + 1)]
a2 = [0 for i in range(n + 1)]
a1[1] = s[0]
a2[2] = s[1]
for i in range(2, n + 1):
	if i % 2 == 0:
		a2[i] = a2[i - 1 - 1] + s[i - 1]
		a1[i] = a1[i - 1]
	else:
		a1[i] = a1[i - 2] + s[i - 1]
		a2[i] = a2[i - 1]
ans = 0
for i in range(1, n + 1):
	if a1[i - 1] + a2[-1] - a2[i] == a1[-1] - a1[i] + a2[i - 1]:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
ans = 0
even = [a[0]] + [0] * (n - 1)
odd = [0] * n
for i in range(1, n):
	if i % 2 == 0:
		even[i] = even[i - 1] + a[i]
		odd[i] = odd[i - 1]
	else:
		odd[i] = odd[i - 1] + a[i]
		even[i] = even[i - 1]
for i in range(n):
	if i % 2 == 0:
		if odd[-1] - odd[i] + even[i] - a[i] == even[-1] - even[i] + odd[i]:
			ans += 1
	elif odd[-1] - odd[i] + even[i] == even[-1] - even[i] + odd[i] - a[i]:
		ans += 1
print(int(ans))


n = int(input())
a = [int(x) for x in input().split(' ')]
(up, down) = [[None for _ in range(n)] for _ in range(2)]
k = lambda list, i: list[i] if i >= 0 and i < n else 0
for (i, ai) in enumerate(a):
	up[i] = ai + k(up, i - 2)
for (i, ai) in reversed(list(enumerate(a))):
	down[i] = ai + k(down, i + 2)
result = 0
for i in range(n):
	states = [k(up, i - x) + k(down, i + j + 1) for (j, x) in enumerate([2, 1])]
	if states[0] == states[1]:
		result += 1
print(result)


a = []
sh = []
sn = []
n = int(input())
a = [0] + list(map(int, input().split()))
a.append(0)
sh = [0] * (n + 4)
sn = [0] * (n + 4)
sn[1] = a[1]
sn[2] = a[1]
sh[3] = a[2]
sh[2] = a[2]
for i in range(3, n + 1, 2):
	sn[i] = sn[i - 2] + a[i]
	sn[i + 1] = sn[i]
	sh[i + 1] = sh[i - 1] + a[i + 1]
	sh[i + 2] = sh[i + 1]
ss = sn[n] + sh[n]
o = 0
for i in range(1, n + 1):
	if (ss - a[i]) % 2 == 0:
		s2 = (ss - a[i]) // 2
		l = sn[i - 1]
		r = sh[n + 1] - sh[i]
		if l + r == s2:
			o += 1
print(o)


from itertools import accumulate
n = int(input())
(index, a) = zip(*enumerate(map(int, input().split()), start=1))
a_even = [0] * (n + 1)
a_odd = [0] * (n + 1)
for (i, n) in enumerate(a, start=1):
	if i % 2:
		a_odd[i] = n
	else:
		a_even[i] = n
a_even = tuple(accumulate(a_even))
a_odd = tuple(accumulate(a_odd))
ans = []
for (i, n) in zip(index, a):
	if a_even[i - 1] + a_odd[-1] - a_odd[i] == a_odd[i - 1] - a_even[i] + a_even[-1]:
		ans.append(i)
print(len(ans))


n = int(input())
l2 = list(map(int, input().split()))
so = 0
se = 0
for (i, j) in enumerate(l2):
	if i % 2 == 0:
		so += l2[i]
	else:
		se = se + l2[i]
odd = so
even = se
o = []
e = []
s1 = 0
s2 = 0
for (i, j) in enumerate(l2):
	if i % 2 == 0:
		o.append((s1, so - s1 - j))
		e.append((s2, se - s2))
		s1 = s1 + j
	else:
		o.append((s1, so - s1))
		e.append((s2, se - s2 - j))
		s2 = s2 + j
ans = 0
for (i, j) in enumerate(l2):
	(oi, of) = o[i]
	(ei, ef) = e[i]
	if oi + ef == of + ei:
		ans += 1
print(ans)


number = int(input())
candies = [int(x) for x in input().split()]
evensumarray = [0]
oddsumarray = [0]
for i in range(0, number):
	if i % 2 == 0:
		evensumarray.append(evensumarray[-1] + candies[i])
		oddsumarray.append(oddsumarray[-1])
	else:
		oddsumarray.append(oddsumarray[-1] + candies[i])
		evensumarray.append(evensumarray[-1])
del evensumarray[0]
del oddsumarray[0]

def isgood(index):
	if index != 0:
		esum = evensumarray[index - 1] + oddsumarray[number - 1] - oddsumarray[index]
		osum = oddsumarray[index - 1] + evensumarray[number - 1] - evensumarray[index]
	else:
		esum = oddsumarray[number - 1] - oddsumarray[index]
		osum = evensumarray[number - 1] - evensumarray[index]
	return esum == osum
good = 0
for position in range(number):
	good += int(isgood(position))
print(good)


n = int(input())
arr = list(map(int, input().split()))
odd = 0
even = 0
for i in range(n - 1):
	if i % 2 == 0:
		odd = odd + arr[i]
	else:
		even = even + arr[i]
res = 0
if odd == even:
	res += 1
for i in range(n - 1, 0, -1):
	if i % 2 == 1:
		diff = arr[i] - arr[i - 1]
		odd = odd + diff
	else:
		diff = arr[i] - arr[i - 1]
		even = even + diff
	if odd == even:
		res += 1
print(res)


n = int(input())
s = list(map(int, input().split()))
d = 0
q = 0
for i in range(n):
	if i % 2 == 0:
		d = d + s[i]
	else:
		q = q + s[i]
a = 0
b = 0
z = 0
for i in range(n):
	if i % 2 == 0:
		if b + d - a - s[i] == a + q - b:
			z = z + 1
		a = a + s[i]
	else:
		if b + d - a == a + q - b - s[i]:
			z = z + 1
		b = b + s[i]
print(z)


n = int(input())
lis = list(map(int, input().split()))
if n == 1:
	print('1')
	exit()
i = 2
le = lo = w = 0
ans = [0] * n
ans[0] = lis[0]
ans[1] = lis[1]
while i < n:
	ans[i] = lis[i] + ans[i - 2]
	i += 1
if n % 2 == 0:
	le = ans[-2]
	lo = ans[-1]
else:
	le = ans[-1]
	lo = ans[-2]
for i in range(n - 1, -1, -1):
	if i % 2 == 0:
		even = ans[i]
		odd = ans[i - 1]
		if i == 0:
			odd = 0
		if le - even + odd == lo - odd + even - lis[i]:
			w += 1
	else:
		even = ans[i - 1]
		odd = ans[i]
		if lo - odd + even == le - even + odd - lis[i]:
			w += 1
print(w)


from sys import stdin, stdout
import cProfile, math
from collections import Counter
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)
fac_warmup = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7
import sys

class Operation:

	def __init__(self, name, function, function_on_equal, neutral_value=0):
		self.name = name
		self.f = function
		self.f_on_equal = function_on_equal

def add_multiple(x, count):
	return x * count

def min_multiple(x, count):
	return x

def max_multiple(x, count):
	return x
sum_operation = Operation('sum', sum, add_multiple, 0)
min_operation = Operation('min', min, min_multiple, 1000000000.0)
max_operation = Operation('max', max, max_multiple, -1000000000.0)

class SegmentTree:

	def __init__(self, array, operations=[sum_operation, min_operation, max_operation]):
		self.array = array
		if type(operations) != list:
			raise TypeError('operations must be a list')
		self.operations = {}
		for op in operations:
			self.operations[op.name] = op
		self.root = SegmentTreeNode(0, len(array) - 1, self)

	def query(self, start, end, operation_name):
		if self.operations.get(operation_name) == None:
			raise Exception('This operation is not available')
		return self.root._query(start, end, self.operations[operation_name])

	def summary(self):
		return self.root.values

	def update(self, position, value):
		self.root._update(position, value)

	def update_range(self, start, end, value):
		self.root._update_range(start, end, value)

	def __repr__(self):
		return self.root.__repr__()

class SegmentTreeNode:

	def __init__(self, start, end, segment_tree):
		self.range = (start, end)
		self.parent_tree = segment_tree
		self.range_value = None
		self.values = {}
		self.left = None
		self.right = None
		if start == end:
			self._sync()
			return
		self.left = SegmentTreeNode(start, start + (end - start) // 2, segment_tree)
		self.right = SegmentTreeNode(start + (end - start) // 2 + 1, end, segment_tree)
		self._sync()

	def _query(self, start, end, operation):
		if end < self.range[0] or start > self.range[1]:
			return None
		if start <= self.range[0] and self.range[1] <= end:
			return self.values[operation.name]
		self._push()
		left_res = self.left._query(start, end, operation) if self.left else None
		right_res = self.right._query(start, end, operation) if self.right else None
		if left_res is None:
			return right_res
		if right_res is None:
			return left_res
		return operation.f([left_res, right_res])

	def _update(self, position, value):
		if position < self.range[0] or position > self.range[1]:
			return
		if position == self.range[0] and self.range[1] == position:
			self.parent_tree.array[position] = value
			self._sync()
			return
		self._push()
		self.left._update(position, value)
		self.right._update(position, value)
		self._sync()

	def _update_range(self, start, end, value):
		if end < self.range[0] or start > self.range[1]:
			return
		if start <= self.range[0] and self.range[1] <= end:
			self.range_value = value
			self._sync()
			return
		self._push()
		self.left._update_range(start, end, value)
		self.right._update_range(start, end, value)
		self._sync()

	def _sync(self):
		if self.range[0] == self.range[1]:
			for op in self.parent_tree.operations.values():
				current_value = self.parent_tree.array[self.range[0]]
				if self.range_value is not None:
					current_value = self.range_value
				self.values[op.name] = op.f([current_value])
		else:
			for op in self.parent_tree.operations.values():
				result = op.f([self.left.values[op.name], self.right.values[op.name]])
				if self.range_value is not None:
					bound_length = self.range[1] - self.range[0] + 1
					result = op.f_on_equal(self.range_value, bound_length)
				self.values[op.name] = result

	def _push(self):
		if self.range_value is None:
			return
		if self.left:
			self.left.range_value = self.range_value
			self.right.range_value = self.range_value
			self.left._sync()
			self.right._sync()
			self.range_value = None

	def __repr__(self):
		ans = '({}, {}): {}\n'.format(self.range[0], self.range[1], self.values)
		if self.left:
			ans += self.left.__repr__()
		if self.right:
			ans += self.right.__repr__()
		return ans

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def primeFactors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def binary(n, digits=20):
	b = bin(n)[2:]
	b = '0' * (20 - len(b)) + b
	return b

def isprime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True
factorial_modP = []

def warm_up_fac(MOD):
	nonlocal factorial_modP, fac_warmup
	if fac_warmup:
		return
	factorial_modP = [1 for _ in range(fac_warmup_size + 1)]
	for i in range(2, fac_warmup_size):
		factorial_modP[i] = factorial_modP[i - 1] * i % MOD
	fac_warmup = True

def InverseEuler(n, MOD):
	return pow(n, MOD - 2, MOD)

def nCr(n, r, MOD):
	nonlocal fac_warmup, factorial_modP
	if not fac_warmup:
		warm_up_fac(MOD)
		fac_warmup = True
	return factorial_modP[n] * (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD) % MOD) % MOD

def test_print(*args):
	if testingMode:
		print(args)

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
import heapq, itertools
pq = []
entry_finder = {}
REMOVED = '<removed-task>'

def add_task(task, priority=0):
	if task in entry_finder:
		remove_task(task)
	count = next(counter)
	entry = [priority, count, task]
	entry_finder[task] = entry
	heapq.heappush(pq, entry)

def remove_task(task):
	entry = entry_finder.pop(task)
	entry[-1] = REMOVED

def pop_task():
	while pq:
		(priority, count, task) = heapq.heappop(pq)
		if task is not REMOVED:
			del entry_finder[task]
			return task
	raise KeyError('pop from an empty priority queue')
memory = dict()

def clear_cache():
	nonlocal memory
	memory = dict()

def cached_fn(fn, *args):
	nonlocal memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result
TestCases = False
testingMode = False
fac_warmup_size = 10 ** 5 + 100
optimiseForReccursion = True

def main():
	n = get_int()
	li = get_list()
	odd_sum = [0]
	even_sum = [0]
	for (i, ele) in enumerate(li):
		if i % 2 == 0:
			even_sum.append(even_sum[-1] + ele)
			odd_sum.append(odd_sum[-1])
		else:
			odd_sum.append(odd_sum[-1] + ele)
			even_sum.append(even_sum[-1])
	res = 0
	for i in range(1, n + 1):
		if even_sum[i - 1] + odd_sum[-1] - odd_sum[i] == odd_sum[i - 1] + even_sum[-1] - even_sum[i]:
			res += 1
	print(res)
if TestCases:
	for _ in range(get_int()):
		cProfile.run('main()') if testingMode else main()
else:
	(cProfile.run('main()') if testingMode else main()) if not optimiseForReccursion else threading.Thread(target=main).start()


n = int(input())
candy = list(map(int, input().split()))
evenLeft = 0
evenRight = 0
oddLeft = 0
oddRight = 0
count = 0
for i in range(n):
	if i % 2 == 0:
		evenRight += candy[i]
	else:
		oddRight += candy[i]
evenRight -= candy[0]
(evenRight, oddRight) = (oddRight, evenRight)
if evenRight == oddRight:
	count += 1
for i in range(1, n):
	evenRight -= candy[i]
	(evenRight, oddRight) = (oddRight, evenRight)
	evenLeft += candy[i - 1]
	(evenLeft, oddLeft) = (oddLeft, evenLeft)
	if oddLeft + oddRight == evenLeft + evenRight:
		count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
e = 0
o = 0
for i in range(n):
	if i % 2 != 0:
		e += l[i]
	else:
		o += l[i]
ep = op = 0
count = 0
for i in range(n):
	xo = o - op
	xe = e - ep
	if i % 2 != 0:
		xe = xe - l[i]
	else:
		xo = xo - l[i]
	es = ep + xo
	os = op + xe
	if es == os:
		count += 1
	if i % 2 != 0:
		ep += l[i]
	else:
		op += l[i]
print(count)


n = int(input())
l = list(map(int, input().split()))
sum1 = 0
sum2 = 0
count = 0
for i in range(n):
	if i % 2 == 0:
		sum1 += l[i]
	else:
		sum2 += l[i]
for i in range(n):
	if i % 2 == 0:
		sum1 -= l[i]
		if i - 1 >= 0:
			sum1 += l[i - 1]
	else:
		sum2 -= l[i]
		if i - 1 >= 0:
			sum2 += l[i - 1]
	if sum1 == sum2:
		count += 1
print(count)


n = int(input())
inp = input().split()
ep = 0
op = 0
os = 0
es = 0
for i in range(len(inp)):
	if (i + 1) % 2 == 0:
		ep = ep + int(inp[i])
	else:
		op = op + int(inp[i])
count = 0
for i in range(0, n):
	if (i + 1) % 2 == 0:
		ep = ep - int(inp[i])
	else:
		op = op - int(inp[i])
	if op + es == ep + os:
		count = count + 1
	if (i + 1) % 2 == 0:
		es = es + int(inp[i])
	else:
		os = os + int(inp[i])
print(count)


n = int(input())
a = list(map(int, input().split()))
sum1 = sum2 = sum3 = sum4 = 0
if n == 1:
	print(1)
else:
	ans = 0
	for q in range(1, n):
		if q % 2 == 0:
			sum1 += a[q]
		else:
			sum2 += a[q]
	for q in range(1, n):
		if q % 2 == 0:
			if sum2 + sum3 == sum1 + sum4:
				ans += 1
			sum1 -= a[q]
			sum4 += a[q - 1]
		else:
			if sum2 + sum3 == sum1 + sum4:
				ans += 1
			sum2 -= a[q]
			sum3 += a[q - 1]
	if sum1 + sum4 == sum2 + sum3:
		ans += 1
	print(ans)


import itertools as it
(n, a) = (int(input()), list(map(int, input().split())) + [0, 0])
evens = [0] + list(it.accumulate(a[1::2]))
odds = [0] + list(it.accumulate(a[0::2]))
cnt = 0
for i in range(1, n + 1):
	if i % 2 == 0:
		ev = evens[i // 2 - 1] + (odds[-1] - odds[i // 2])
		od = odds[i // 2] + (evens[-1] - evens[i // 2])
	else:
		ev = evens[i // 2] + (odds[-1] - odds[i // 2 + 1])
		od = odds[i // 2] + (evens[-1] - evens[i // 2])
	if ev == od:
		cnt += 1
print(cnt)


n = int(input())
a = [int(x) for x in input().split()]
odd_even = [0, 0]
ans = 0
for (k, v) in enumerate(a):
	odd_even[k % 2] += v
odd_even[0] -= a[0]
ans += odd_even[0] == odd_even[1]
for i in range(1, n):
	odd_even[i % 2] -= a[i]
	odd_even[i % 2] += a[i - 1]
	ans += odd_even[0] == odd_even[1]
print(ans)


n = int(input())
z = [int(x) for x in input().split(' ')]
(op, ep, os, es, c, a) = (0, 0, 0, 0, 0, 0)
(os, es) = (sum(z[1::2]), sum(z[::2]))
for i in range(n):
	if i % 2 == 0:
		es -= z[i]
		if i > 0:
			op += z[i - 1]
		odd = op + es
		even = ep + os
		if even == odd:
			c += 1
	else:
		os -= z[i]
		if i > 0:
			ep += z[i - 1]
		odd = op + es
		even = ep + os
		if even == odd:
			c += 1
print(c)


n = int(input())
ara = list(map(int, input().split()))
odd = 0
even = 0
for i in range(0, n):
	if i % 2 == 1:
		odd += ara[i]
	else:
		even += ara[i]
odd1 = 0
even1 = 0
ans = 0
for i in range(n):
	if i & 1:
		odd -= ara[i]
	else:
		even -= ara[i]
	if odd1 + even == even1 + odd:
		ans += 1
	if i & 1:
		odd1 += ara[i]
	else:
		even1 += ara[i]
print(ans)


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt, gcd, factorial, pow

def binNumber(n, size=4):
	return bin(n)[2:].zfill(size)

def iar():
	return list(map(int, input().split()))

def ini():
	return int(input())

def isp():
	return map(int, input().split())

def sti():
	return str(input())

def par(a):
	return ' '.join(list(map(str, a)))

def tdl(outerListSize, innerListSize, defaultValue=0):
	return [[defaultValue] * innerListSize for i in range(outerListSize)]

class pair:

	def __init__(self, f, s):
		self.fi = f
		self.se = s

	def __lt__(self, other):
		return (self.fi, self.se) < (other.fi, other.se)
x1 = 0
x2 = 0
o = 0
e = 0
n = ini()
ans = 0
a = iar()
for i in range(0, n, 2):
	o += a[i]
for i in range(1, n, 2):
	e += a[i]
k = -1
if n % 2 == 0:
	k = 0
else:
	k = 1
for i in range(n - 1, -1, -1):
	cnt = n - k - i
	if cnt % 2 == 0:
		o1 = o - a[i] + x2 - x1
		e1 = e - x2 + x1
		if o1 == e1:
			ans += 1
		x1 += a[i]
	else:
		o1 = o + x2 - x1
		e1 = e - a[i] + x1 - x2
		if o1 == e1:
			ans += 1
		x2 += a[i]
print(ans)


n = int(input(''))
a = list(map(int, input().split()))
b = []
ce = 0
co = 0
cnt = 0
if n == 1:
	print('1')
elif n > 2:
	for i in range(1, n + 1):
		if i % 2 == 0:
			ce = ce + a[i - 1]
			b.append([ce, co])
		else:
			co = co + a[i - 1]
			b.append([ce, co])
	for i in range(1, n - 1):
		if b[-1][0] - b[i][0] + b[i - 1][1] == b[-1][1] - b[i][1] + b[i - 1][0]:
			cnt += 1
	if b[-1][0] - b[0][0] == b[-1][1] - b[0][1]:
		cnt += 1
	if b[-2][0] == b[-2][1]:
		cnt += 1
	print(cnt)
else:
	print('0')


n = int(input())
a = [i for i in map(int, input().split())]
sum1 = sum(a[1::2])
sum2 = sum(a[2::2])
sol = 0
if sum1 == sum2:
	sol += 1
for (i, j) in enumerate(a[1:], 1):
	if i % 2 == 1:
		sum1 -= a[i]
		sum1 += a[i - 1]
	else:
		sum2 -= a[i]
		sum2 += a[i - 1]
	if sum1 == sum2:
		sol += 1
print(sol)


n = int(input())
a = list(map(int, input().split()))
d = {-1: 0}
tm2 = 0
tm1 = 0
for i in range(n):
	d[i] = a.pop()
	if i % 2 == 0:
		tm2 += d[i]
	else:
		tm1 += d[i]
ans = 0
for i in range(n):
	if i % 2 == 0:
		tm2 = tm2 - d[i] + d[i - 1]
	else:
		tm1 = tm1 - d[i] + d[i - 1]
	if tm2 == tm1:
		ans += 1
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
count = 0
pesum = 0
posum = 0
osum = 0
esum = 0
for (i, x) in enumerate(a):
	if i % 2 == 0:
		osum += x
	else:
		esum += x
for i in range(n):
	odd_sum = esum + posum
	even_sum = osum + pesum
	if i % 2 == 0:
		osum -= a[i]
		posum += a[i]
		even_sum -= a[i]
	else:
		esum -= a[i]
		pesum += a[i]
		odd_sum -= a[i]
	if even_sum == odd_sum:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().rstrip().split(' ')))
k = n
a = [0] + a + [0]
n += 2
oddp = [0] * n
evenp = [0] * n
i = 1
while i < n:
	oddp[i] = a[i]
	i += 2
i = 2
while i < n:
	evenp[i] = a[i]
	i += 2
i = 3
while i < n:
	oddp[i] += oddp[i - 2]
	i += 2
i = 4
while i < n:
	evenp[i] += evenp[i - 2]
	i += 2
odd = [0] * n
even = [0] * n
i = 0
if k % 2 == 0:
	i = k
else:
	i = k - 1
while i >= 0:
	odd[i] = a[i]
	i -= 2
if k % 2 == 0:
	i = k - 2
else:
	i = k - 3
while i >= 0:
	odd[i] += odd[i + 2]
	i -= 2
i = 0
if k % 2 == 0:
	i = k - 1
else:
	i = k
while i >= 0:
	even[i] = a[i]
	i -= 2
if k % 2 == 0:
	i = k - 3
else:
	i = k - 2
while i >= 0:
	even[i] += even[i + 2]
	i -= 2
f = odd
odd = even
even = f
ans = 0
for i in range(1, n - 1):
	if i % 2 != 0:
		odds = oddp[i] - a[i] + even[i + 1]
		evens = evenp[i - 1] + odd[i] - a[i]
		if odds == evens:
			ans += 1
	else:
		odds = oddp[i - 1] + even[i] - a[i]
		evens = evenp[i] - a[i] + odd[i + 1]
		if odds == evens:
			ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split(' ')))
all_sum = sum(a)
odd = [0] * n
even = [0] * n
odd[0] = 0
even[0] = a[0]
for i in range(1, n):
	if i & 1 == 1:
		odd[i] = odd[i - 1] + a[i]
		even[i] = even[i - 1]
	else:
		odd[i] = odd[i - 1]
		even[i] = even[i - 1] + a[i]
res = 0
for i in range(n):
	need = all_sum - a[i]
	if need & 1 == 1:
		continue
	need //= 2
	if i == 0:
		s = 0 + even[n - 1] - even[i]
	else:
		s = odd[i - 1] + even[n - 1] - even[i]
	if need == s:
		res += 1
print(res)


n = int(input())
weight = list(map(int, input().split()))
even = 0
odd = 0
k = 1
good = 0
while k < n:
	if k % 2 == 1:
		even += weight[k]
	else:
		odd += weight[k]
	k += 1
if even == odd:
	good = 1
for i in range(1, n):
	if i % 2 == 1:
		even -= weight[i]
		even += weight[i - 1]
	else:
		odd -= weight[i]
		odd += weight[i - 1]
	if odd == even:
		good += 1
print(str(good))


n = int(input())
s = list(map(int, input().split()))
c = 0
ot = es = os = et = 0
for i in range(1, n, 1):
	if i % 2 == 1:
		es += s[i]
	else:
		os += s[i]
for i in range(n):
	if i != 0:
		if i % 2 == 1:
			et += s[i - 1]
			es -= s[i]
		else:
			ot += s[i - 1]
			os -= s[i]
	if ot + os == et + es:
		c += 1
print(c)


n = int(input())
l = list(map(int, input().split()))
sum_even = 0
sum_odd = 0
for i in range(n):
	if i % 2 == 0:
		sum_odd += l[i]
	else:
		sum_even += l[i]
count = 0
sum1_even = 0
sum1_odd = 0
for i in range(n):
	if i % 2 == 0:
		sum1_odd += l[i]
		if sum1_odd - l[i] + sum_even - sum1_even == sum1_even + sum_odd - sum1_odd:
			count += 1
	else:
		sum1_even += l[i]
		if sum1_even - l[i] + sum_odd - sum1_odd == sum1_odd + sum_even - sum1_even:
			count += 1
print(count)


n = int(input())
nums = [int(x) for x in input().split(' ')]
odd_l_r = [0 for i in range(n + 2)]
even_l_r = [0 for i in range(n + 2)]
odd_r_l = [0 for i in range(n + 2)]
even_r_l = [0 for i in range(n + 2)]
for i in range(1, n + 1):
	if i % 2 == 0:
		even_l_r[i] = even_l_r[i - 1] + nums[i - 1]
		odd_l_r[i] = odd_l_r[i - 1]
	else:
		even_l_r[i] = even_l_r[i - 1]
		odd_l_r[i] = odd_l_r[i - 1] + nums[i - 1]
for i in range(n, 0, -1):
	if i % 2 == 0:
		even_r_l[i] = even_r_l[i + 1] + nums[i - 1]
		odd_r_l[i] = odd_r_l[i + 1]
	else:
		even_r_l[i] = even_r_l[i + 1]
		odd_r_l[i] = odd_r_l[i + 1] + nums[i - 1]
ans = 0
for i in range(1, n + 1):
	if even_l_r[i] + odd_r_l[i] == even_r_l[i] + odd_l_r[i]:
		ans = ans + 1
print(ans)


n = int(input())
a = (int(x) for x in input().split())
odd_sums = [0] * (n + 1)
even_sums = [0] * (n + 1)
odd_sum = 0
even_sum = 0
for (i, val) in enumerate(a):
	if i % 2 == 0:
		even_sum += val
	else:
		odd_sum += val
	even_sums[i + 1] = even_sum
	odd_sums[i + 1] = odd_sum
count = 0
for i in range(1, n + 1):
	even_before = even_sums[i - 1]
	odd_before = odd_sums[i - 1]
	even_after = odd_sums[-1] - odd_sums[i]
	odd_after = even_sums[-1] - even_sums[i]
	if even_before + even_after == odd_before + odd_after:
		count += 1
print(count)


amount = int(input())
array = [int(s) for s in input().split()]
preff_ev = [0]
preff_od = [0]
post_ev = [0]
post_od = [0]
for i in range(1, len(array)):
	if not i % 2:
		preff_ev.append(preff_ev[-1] + array[i - 1])
		preff_od.append(preff_od[-1])
	else:
		preff_od.append(preff_od[-1] + array[i - 1])
		preff_ev.append(preff_ev[-1])
flag = (len(array) - 1) % 2
for i in range(1, len(array)):
	if not (len(array) - i - 1) % 2:
		post_ev.append(post_ev[-1] + array[len(array) - i])
		post_od.append(post_od[-1])
	else:
		post_od.append(post_od[-1] + array[len(array) - i])
		post_ev.append(post_ev[-1])
counter = 0
for i in range(len(array)):
	if preff_od[i] + post_ev[len(array) - i - 1] == preff_ev[i] + post_od[len(array) - i - 1]:
		counter += 1
print(counter)


n = int(input())
a = list(map(int, input().split()))
if n >= 4:
	ans = 0
	(b, c) = ([0] * n, [0] * n)
	b[n - 1] = a[n - 1]
	b[n - 2] = a[n - 2]
	c[0] = a[0]
	c[1] = a[1]
	for i in range(n - 3, -1, -1):
		b[i] = b[i + 2] + a[i]
	for i in range(2, n):
		c[i] = c[i - 2] + a[i]
	for i in range(n):
		if i > 1 and i < n - 2:
			if c[i - 1] + b[i + 2] == c[i - 2] + b[i + 1]:
				ans += 1
		elif i < 2:
			if i == 1 and b[i + 1] == b[i + 2] + c[i - 1]:
				ans += 1
			if i == 0 and b[i + 1] == b[i + 2]:
				ans += 1
		else:
			if i == n - 2 and c[n - 3] == c[n - 4] + b[n - 1]:
				ans += 1
			if i == n - 1 and c[n - 3] == c[n - 2]:
				ans += 1
	print(ans)
elif n == 3:
	ans = 0
	if a[1] == a[2]:
		ans += 1
	if a[0] == a[1]:
		ans += 1
	if a[0] == a[2]:
		ans += 1
	print(ans)
elif n == 1:
	print(1)
else:
	print(0)


n = int(input())
a = list(map(int, input().split()))
(sume, sumo, sumeb, sumob) = (0, 0, 0, 0)
for i in range(len(a)):
	if i % 2 == 0:
		sumo += a[i]
	else:
		sume += a[i]
ans = 0
for i in range(len(a)):
	if i % 2 == 0 and sumo - a[i] - sumob + sumeb == sume - sumeb + sumob or (i % 2 == 1 and sumo - sumob + sumeb == sume - a[i] - sumeb + sumob):
		ans += 1
	if i % 2 == 0:
		sumob += a[i]
	else:
		sumeb += a[i]
print(ans)


n = int(input())
a = list(map(int, input().split()))
d = {-1: 0}
e = 0
o = 0
for i in range(n):
	d[i] = a.pop()
	if i % 2 == 0:
		e += d[i]
	else:
		o += d[i]
ans = 0
for i in range(n):
	if i % 2 == 0:
		e = e - d[i] + d[i - 1]
	else:
		o = o - d[i] + d[i - 1]
	if e == o:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
num = 0
odd = a[1::2]
even = a[2::2]
sum_odd = sum(odd)
sum_even = sum(even)
if sum_odd == sum_even:
	num += 1
for i in range(1, n):
	if i % 2:
		sum_odd += a[i - 1] - a[i]
	else:
		sum_even += a[i - 1] - a[i]
	if sum_odd == sum_even:
		num += 1
print(num)


(N, A) = (int(input()), list(map(int, input().split())))
(s1, s2) = (sum(A[1::2]), sum(A[2::2]))
k = int(s1 == s2)
for i in range(N - 1):
	if i % 2:
		s2 += A[i] - A[i + 1]
	else:
		s1 += A[i] - A[i + 1]
	k += s1 == s2
print(k)


n = int(input())
l = [int(i) for i in input().split()]
odd = [0] * (n + 1)
even = [0] * (n + 1)
for i in range(1, n + 1):
	if i % 2 == 0:
		even[i] += l[i - 1]
	else:
		odd[i] += l[i - 1]
for i in range(1, n + 1):
	odd[i] += odd[i - 1]
	even[i] += even[i - 1]
ans = 0
for i in range(1, n + 1):
	odd_sum = odd[i - 1]
	even_sum = even[i - 1]
	odd_sum += even[n] - even[i]
	even_sum += odd[n] - odd[i]
	if odd_sum == even_sum:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
cum = [0] * n
even = [0] * n
odd = [0] * n
cum[0] = a[0]
odd[0] = a[0]
even[0] = 0
for i in range(1, n):
	cum[i] = cum[i - 1] + a[i]
	if i % 2 != 0:
		even[i] = even[i - 1] + a[i]
		odd[i] = odd[i - 1]
	else:
		odd[i] = odd[i - 1] + a[i]
		even[i] = even[i - 1]
temp1 = 0
temp2 = 0
Etemp = 0
Otemp = 0
count = 0
for i in range(n):
	if (i + 1) % 2 == 1:
		temp1 = odd[i] - a[i]
		temp2 = even[i]
	if (i + 1) % 2 == 0:
		temp2 = even[i] - a[i]
		temp1 = odd[i]
	Etemp = even[n - 1] - even[i]
	Otemp = odd[n - 1] - odd[i]
	if temp1 + Etemp == temp2 + Otemp:
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a += [0]
ss = []
s = 0
ss2 = []
s2 = 0
for w in range(0, n):
	if w % 2 == 0:
		s2 += a[w]
		ss2 += [s2]
	else:
		s += a[w]
		ss += [s]
k = 0
ss += [0]
ss2 += [0]
for w in range(0, n):
	if w % 2 == 0:
		ws2 = ss2[w // 2] - a[w] + s - ss[w // 2 - 1]
		ws = ss[w // 2 - 1] + s2 - ss2[w // 2]
	else:
		ws2 = ss2[w // 2 * 1] + s - ss[w // 2 - 1]
		ws = ss[w // 2] + s2 - ss2[w // 2]
	if ws == ws2:
		k += 1
print(k)


def get_candy_count(a):
	pref_sums = [[0], [0]]
	total_sum = 0
	for (ind, elem) in enumerate(a, start=1):
		pref_sums[ind % 2].append(pref_sums[ind % 2][-1] + elem)
		total_sum += elem
	ans = 0
	if pref_sums[0][-1] == pref_sums[1][-1] - pref_sums[1][1]:
		ans += 1
	if len(a) > 1:
		if len(a) % 2 == 0 and pref_sums[0][-2] == pref_sums[1][-1]:
			ans += 1
		elif len(a) % 2 == 1 and pref_sums[1][-2] == pref_sums[0][-1]:
			ans += 1
	for give_id in range(2, len(a)):
		even_pos_sum = pref_sums[0][(give_id - 1) // 2]
		even_pos_sum += pref_sums[1][-1] - pref_sums[1][(give_id + 1) // 2]
		odd_pos_sum = pref_sums[1][give_id // 2]
		odd_pos_sum += pref_sums[0][-1] - pref_sums[0][give_id // 2]
		if even_pos_sum == odd_pos_sum:
			ans += 1
	return ans
n = int(input())
a = list(map(int, input().split()))
print(get_candy_count(a))


_ = input()
n = int(_)
_ = input()
a = _.split()
a = [int(_) for _ in a]
odds = 0
even = 0
b = []
for (i, value) in enumerate(a):
	if i % 2 == 0:
		even = even + value
	else:
		odds = odds + value
reverse_even = 0
reverse_odds = 0
answer = 0
for (i, value) in enumerate(a):
	if i % 2 == 0:
		even = even - value
	else:
		odds = odds - value
	if even + reverse_odds == odds + reverse_even:
		answer = answer + 1
	if i % 2 == 0:
		reverse_even = reverse_even + value
	else:
		reverse_odds = reverse_odds + value
print(answer)


from collections import *
from math import *
n = int(input())
a = list(map(int, input().split()))
(o, e, fo, fe) = (0, 0, 0, 0)
for i in range(n):
	if i & 1:
		o += a[i]
	else:
		e += a[i]
ans = 0
for i in range(n):
	if i & 1:
		o -= a[i]
		x = o + fe
		y = e + fo
		fo += a[i]
	else:
		e -= a[i]
		x = o + fe
		y = e + fo
		fe += a[i]
	if x == y:
		ans += 1
print(ans)


n = int(input())
a = input().split()
b = 0
c = 0
for i in range(1, n):
	if i % 2 == 0:
		b += int(a[i])
	else:
		c += int(a[i])
if b == c:
	count = 1
else:
	count = 0
for j in range(1, n):
	if j % 2 != 0:
		c -= int(a[j])
		c += int(a[j - 1])
		if b == c:
			count += 1
	else:
		b -= int(a[j])
		b += int(a[j - 1])
		if b == c:
			count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
if n == 1:
	print(1)
else:
	eve = []
	odd = []
	for i in range(n):
		if i % 2:
			odd.append(l[i])
		else:
			eve.append(l[i])
	oddl = n // 2
	evel = oddl
	if n % 2:
		evel += 1
	for i in range(1, evel):
		eve[i] += eve[i - 1]
	for i in range(1, oddl):
		odd[i] += odd[i - 1]
	c = 0
	for i in range(n):
		if i == 0:
			if eve[-1] - l[i] == odd[-1]:
				c += 1
			continue
		if i == 1:
			if eve[0] + odd[-1] - odd[0] == eve[-1] - eve[0]:
				c += 1
			continue
		if i % 2 == 0:
			k = i // 2
			eves = eve[k - 1] + odd[-1] - odd[k - 1]
			odds = odd[k - 1] + eve[-1] - eve[k]
			if eves == odds:
				c += 1
		else:
			k = i // 2
			eves = eve[k] + odd[-1] - odd[k]
			odds = odd[k - 1] + eve[-1] - eve[k]
			if eves == odds:
				c += 1
	print(c)


n = int(input())
lef = []
lof = []
leb = []
lob = []
li = list(map(int, input().split()))
if n == 1:
	print(1)
else:
	preve = li[0]
	prevo = li[1]
	for i in range(n):
		if i == 0:
			lef.append(li[0])
		elif i == 1:
			lof.append(li[1])
		elif i % 2 == 0:
			lef.append(li[i] + preve)
			preve += li[i]
		else:
			lof.append(li[i] + prevo)
			prevo += li[i]
	leb.append(lef[len(lef) - 1])
	lob.append(lof[len(lof) - 1])
	preve = leb[0]
	prevo = lob[0]
	for i in range(n - 2):
		if i % 2 == 0:
			leb.append(preve - li[i])
			preve -= li[i]
		else:
			lob.append(prevo - li[i])
			prevo -= li[i]
	ct = 0
	for i in range(n):
		if n == 1:
			ct += 1
			break
		if n == 2:
			break
		if i == 0:
			if leb[1] == lob[0]:
				ct += 1
		elif i == 1 and n > 3:
			if lef[0] + lob[1] == leb[1]:
				ct += 1
		elif i == 1 and n == 3:
			if li[0] == li[2]:
				ct += 1
		elif n % 2 == 0:
			if i == n - 1:
				if lef[n // 2 - 1] == lof[n // 2 - 2]:
					ct += 1
			elif i == n - 2:
				if lof[n // 2 - 2] == lef[n // 2 - 2] + lob[n // 2 - 1]:
					ct += 1
			elif i % 2 == 0:
				if lef[i // 2 - 1] + lob[i // 2] == lof[i // 2 - 1] + leb[i // 2 + 1]:
					ct += 1
			elif lef[i // 2] + lob[i // 2 + 1] == lof[i // 2 - 1] + leb[i // 2 + 1]:
				ct += 1
		elif n % 2 == 1:
			if i == n - 1:
				if lef[n // 2 - 1] == lof[n // 2 - 1]:
					ct += 1
			elif i == n - 2:
				if lef[n // 2 - 1] == lof[n // 2 - 2] + leb[n // 2]:
					ct += 1
			elif i % 2 == 0:
				if lef[i // 2 - 1] + lob[i // 2] == lof[i // 2 - 1] + leb[i // 2 + 1]:
					ct += 1
			elif lef[i // 2] + lob[i // 2 + 1] == lof[i // 2 - 1] + leb[i // 2 + 1]:
				ct += 1
	print(ct)


n = int(input())
a = list(map(int, input().split()))
c = 0
d = []
for i in range(0, n):
	if i == 0:
		d.append(a[0])
	elif i % 2 == 0:
		d.append(d[i - 1] + a[i])
	else:
		d.append(d[i - 1] - a[i])
for j in range(0, n):
	if j == 0:
		if d[-1] - d[0] == 0:
			c += 1
	elif j == n - 1:
		if d[j - 1] == 0:
			c += 1
	elif d[j - 1] == d[-1] - d[j]:
		c += 1
print(c)


n = int(input())
A = list(map(int, input().split()))
ans = 0
CH = 0
NCH = 0
pred_elem = 0
next_elem = 0
x = True
for j in range(0, n, 2):
	NCH += A[j]
for j in range(1, n, 2):
	CH += A[j]
for i in range(0, n):
	next_elem = A[i]
	if x == True:
		NCH = NCH - next_elem + pred_elem
		x = False
	else:
		CH = CH - next_elem + pred_elem
		x = True
	if CH == NCH:
		ans += 1
	pred_elem = next_elem
print(ans)


N = int(input())
arr = input()
arr = [int(x) for x in arr.split(' ')]
odd = 0
even = 0
res = 0
for i in range(1, N):
	if i % 2 == 1:
		odd += arr[i]
	else:
		even += arr[i]
if odd == even:
	res += 1
for i in range(1, N):
	if i % 2 == 1:
		odd -= arr[i]
		odd += arr[i - 1]
	else:
		even -= arr[i]
		even += arr[i - 1]
	if odd == even:
		res += 1
print(res)


n = int(input())
(*a,) = map(int, input().split())
if n == 1:
	print(1)
	exit()
wa = [0, 0]
for i in range(n):
	wa.append(wa[-2] + a[i])
sum_odd = sum(a[1::2])
sum_even = sum(a[::2])
wa = wa[2:]
ans = 0
for i in range(n):
	if i % 2:
		odd = wa[i] - a[i] + sum_even - wa[i - 1]
		even = wa[i - 1] + sum_odd - wa[i]
	else:
		odd = sum_even - wa[i]
		even = wa[i] - a[i] + sum_odd
		if i != 0:
			odd += wa[i - 1]
			even -= wa[i - 1]
	if even == odd:
		ans += 1
print(ans)


import sys
n = int(sys.stdin.readline())
a = [int(tmp) for tmp in sys.stdin.readline().split()]
s1 = sum(a[::2])
s2 = sum(a[1::2])
gcc = 0
ts = [s1, s2]
tsn = 0
pea = 0
for ea in a:
	ts[tsn] += pea
	ts[tsn] -= ea
	pea = ea
	if ts[0] == ts[1]:
		gcc += 1
	tsn = 1 - tsn
print(gcc)


n = int(input())
li = [int(i) for i in input().split()]
result = c = t = 0
a = b = 0
for i in range(n - 1):
	if (i + 1) % 2 != 0:
		a += li[i + 1]
	else:
		b += li[i + 1]
if a == b:
	result += 1
t = True
for i in range(1, n):
	if t:
		a = a - li[i] + li[i - 1]
		t = False
	else:
		b = b - li[i] + li[i - 1]
		t = True
	if a == b:
		result += 1
print(result)


def main():
	n = int(input())
	aa = [int(i) for i in input().split()]
	esuf = osuf = epref = opref = ans = 0
	for i in range(n):
		if i % 2 == 0:
			esuf += aa[i]
		else:
			osuf += aa[i]
	for i in range(n):
		x = 1
		if i % 2 == 0:
			x = 0
			esuf -= aa[i]
		else:
			osuf -= aa[i]
		if epref + osuf == opref + esuf:
			ans += 1
		if x == 0:
			epref += aa[i]
		else:
			opref += aa[i]
	print(ans)
main()


n = int(input())
a = list(map(int, input().split()))
s_o = sum([a[i] for i in range(n) if i % 2 == 0])
s_e = sum([a[i] for i in range(n) if i % 2 == 1])
c = 0
prv_o = 0
prv_e = 0
for i in range(n):
	if i % 2 == 0:
		if s_o - a[i] + prv_e == s_e + prv_o:
			c += 1
		s_o -= a[i]
		prv_o += a[i]
	elif i % 2 == 1:
		if s_e - a[i] + prv_o == s_o + prv_e:
			c += 1
		s_e -= a[i]
		prv_e += a[i]
print(c)


N = int(input())
A = []
even = odd = 0
for (i, a) in enumerate(map(int, input().split(' '))):
	A.append(a)
	if i % 2 == 0:
		odd += a
	else:
		even += a
odd -= A[0]
o = int(odd == even)
for i in range(1, N):
	if i % 2:
		even += A[i - 1] - A[i]
	else:
		odd += A[i - 1] - A[i]
	if even == odd:
		o += 1
print(o)


n = int(input())
a = list(map(int, input().split()))
(esum, osum) = (0, 0)
(ecurr, ocurr) = (0, 0)
cnt = 0
for i in range(n):
	if i % 2 == 0:
		osum += a[i]
	else:
		esum += a[i]
for i in range(n):
	if i % 2 == 0:
		ocurr += a[i]
	else:
		ecurr += a[i]
	if i % 2 != 0:
		x = ocurr + esum - ecurr
		y = osum + ecurr - ocurr - a[i]
	else:
		x = osum - ocurr + ecurr
		y = esum + ocurr - ecurr - a[i]
	if x == y:
		cnt += 1
print(cnt)