unittest
{
	assert( [ "4", "2 5 4 6" ].parse.expand.solve == 5 );
	assert( [ "9", "0 0 0 0 0 0 0 0 0" ].parse.expand.solve == 45 );
	assert( [ "19", "885 8 1 128 83 32 256 206 639 16 4 128 689 32 8 64 885 969 1" ].parse.expand.solve == 37 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	auto ans = 0L;
	auto l = 0L;
	auto r = 0L;
	auto x = 0L;
	auto t = 0L;
	while( r < as.length )
	{
		if( ( x ^ as[ r ] ) == ( t + as[ r ] ) )
		{
			x ^= as[ r ];
			t += as[ r ];
			r++;
			ans += r - l;
		}
		else
		{
			x ^= as[ l ];
			t -= as[ l ];
			l++;
		}
	}
	return ans;
}
