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

for i := 1 to n do
 begin
 read(x);

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