var n,i,k,l:longint;
    c:char;
    infile, outfile, ansfile: text;
begin
 assign(infile, paramStr(1));
 assign(outfile, paramStr(2));
 reset(infile);
 readln(infile,n);
 for i:=1 to n do
   begin
    read(infile,c);
    if c='-' then inc(l);
   end;
 close(infile);
 reset(outfile);
 for i:=1 to n do
   begin
    readln(outfile,k);
    l:=abs(l+i-2*k);
   end;
 if (l=0) or (l=n) then writeln(10)
                   else writeln(0);
 close(outfile);
end.