#P8355. 「WHOI-1」ymh 是 AK 哥!!!

「WHOI-1」ymh 是 AK 哥!!!

Input Format

The first line contains a positive integer nn, the length of the string.

The next line contains a string ss.

Output Format

Output one non-negative integer, the answer.

3
(()
2
2
()
2

Hint

This problem uses Subtask\texttt{Subtask} scoring. You can get the score of a Subtask\texttt{Subtask} only if you pass all test points in that Subtask\texttt{Subtask}.

Subtask\texttt{Subtask} ID Special Restrictions Score
1 Contains only left parentheses or only right parentheses 2
2 n2n \leq 2 3
3 n10n \leq 10 10
4 n1000n \leq 1000 20
5 None 65

For 100%100\% of the testdata, it is guaranteed that 1n1061 \leq n \leq 10^6.

Translated by ChatGPT 5