n = int(input())
s = input()
l = []
for i, c in enumerate(s):
    if c == '(':
        l.append('(')
    else:
        l.append('+1)')
    if i < len(s) - 1 and c == ')' and s[i+1] == '(':
        l.append('*')
s2 = "".join(l)
print(eval(s2))