program savey;
uses math;
type arr=array of 0..1;
var i,n:integer; m:int64;
A,B:arr;
begin
assign(input,'savey.in'); reset(input);
assign(output,'savey.out'); rewrite(output);
readln(n);
SetLength(A,n+1); SetLength(B,n+1);
for i:=n downto 1 do read(A[i]);
B[1]:=A[1];
for i:=2 to n do B[i]:=A[i] xor B[i-1];
m:=0;
for i:=1 to n do
if B[i]=1 then m+=2**(n-i);
writeln(m);
close(input); close(output);
end.