s = input().strip() stack = [0] for c in s: if c == '(': stack.append(0) else: top = stack.pop() if top == 0: stack[-1] += 1 else: stack[-1] += top print(0 if stack[0] % 2 == 1 else 1)