#include int main(){ int N=1; scanf("%d", &N); if(N%2!=0){ return 0; } char pom[N+1]; for(int i=0;i<(N+1);i++){ scanf("%c", &pom[i]); }; int pom1=0; for(int i=0;i<=(N+1);i++){ if(pom[i]=='('&&pom[i+1]==')'){ pom1++; }else if(pom[i]==')'&&pom[i+1]==')'){ pom1++; } } printf("%d\n", pom1); return 0; } //We tried it several times with different examples(2,4,6,8,10,12) and we got correct // answers for each of them. Can you clarify our issue?