program anagramma(input,output);
type word=packed array[1..10] of char;
var x,y:word; ag,b:boolean; i,j:integer;
begin for i:=1 to 10 do read(x[i]);
      for i:=1 to 10 do read(y[i]);
      ag:=true;
      for i:=1 to 10 do
          begin b:=false; j:=1; while (b=false)and(j<=10) do
                     begin b:=x[i]=y[j]; j:=j+1 end;
                ag:=ag and b end;
      writeln(ag)
end.