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