#include<bits/stdc++.h>
template <typename _Tp>void read(_Tp &x){
	char ch(getchar());bool f(false);while(!isdigit(ch))f|=ch==45,ch=getchar();
	x=ch&15,ch=getchar();while(isdigit(ch))x=x*10+(ch&15),ch=getchar();
	if(f)x=-x;
}
template <typename _Tp,typename... Args>void read(_Tp &t,Args &...args){read(t);read(args...);}
const int N=300005;
typedef long long ll;
int a[N];
ll s[N];
std::map<ll,int> mp;
int main(){
	int n;read(n);
	for(int i=1;i<=n;++i)read(a[i]);
	ll ans=0;
	++mp[0];
	for(int i=1;i<=n;++i){
		s[i]=s[i-1]+(i%2?a[i]:-a[i]);
		ans+=mp[s[i]]++;
	}
	printf("%lld\n",ans);
	return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int f[11]={2,3,5,7,11,13,17,19,23,29,31};
    int m[11]={0};
    int n;
    cin>>n;
    long long daan=1;
    for(int i=2;i<=n;i++)
    {
        int ans=i;
        for(int c=0;f[c]<=n;c++)
            {
                if(ans%f[c]==0)
                {
                    int flag=0;
                    while(ans%f[c]==0)
                    {
                        ans/=f[c];
                        flag++;
                    }
                    if(flag>m[c])
                        m[c]=flag;
                }
            }
    }
    for(int i=0;i<=10;i++)
    {
        if(m[i]!=0)
            daan*=pow(f[i],m[i]);
    }
    cout<<daan+1;
    return 0;
}