const nmax=100010;
var n,i:int64;
    j:0..30;
    a:array[1..nmax] of int64;
    count:array[0..1]of int64;
    flag:boolean;
begin
read(n);flag:=true;
for i := 1 to n do read(a[i]);

for j := 0 to 30 do
 begin
 count[0]:=0;count[1]:=0;
 for i := 1 to n do 
 inc(count[a[i]>>1]);
 if not((count[1]=0)or(count[1]=2*count[0]))
        then flag:=false;
 end;
if flag then write('Yes') else write('No');
end.