import sys s = sys.stdin.read()[:-1] print(sum(map(lambda c: [-1,1][c=='('],s)))