/DAYNGO - Dãy ngoặc đúng

<Problem>

http://ntucoder.net/Problem/Details/139
              Uses Crt;
        Var  n,count:longint; s:ansistring;  a:array[1..10000] of char;
        Procedure Check;
        var s1:ansistring; d:string; k:longint;
        begin
            s:='';
            for k:=1 to n do begin s:=s+a[k]; end;     //writeln(s);
            s1:=s;
            d:='()';
            while pos(d,s)<>0 do delete(s,pos(d,s),2);
            if s='' then begin writeln(s1); inc(count); end;
            s:='';
        end;
        Procedure Try(i:longint);
        var  j:char;
        begin
            for j:='(' to ')' do
             begin
                 a[i]:=j;
                 if i=n then Check else Try(i+1);
             end;
        end;
        Begin
            readln(n); count:=0;
            try(1);  //s:='(())'; check;
            writeln(count);
            readln;
        End.