program skobki(input,output);
var c:char; s:integer; b:boolean;
begin
   read(c); s:=0;
   while (c<>'.')and (s>=0) do
    begin if c='(' then s:=s+1 else if c=')' then s:=s-1; read(c) end;
    b:=s=0; writeln(b)
end.
