var n,i,x,j:int64;
    a:array[1..3]of int64;
    flag:boolean;
begin
read(n);
for i := 1 to 3 do 
 begin 
 a[i]:=-1;
 flag:=false;
 end;
for i := 1 to n do
 begin
 read(x);

 for j := 1 to 3 do
 begin
 if a[j]=x then flag:=true;
 if a[j] < 0  then begin a[j]:=x;flag:=true end;
 end;
 if not flag then break;
 end;
 if flag then write('Yes') else write('No');
end.