ll@n,d[2n]{1d12};char@s[2n];rep(i,2n){ll@a,f=s[i]^40;d[i+3]=1d12;rrep(j,0,i+2,2)d[j+1]=min(d[j]+f*a,d[j+2]+!f*a);}wt(d[1]);