H = input().strip() stack = [] depths = [] for c in H: if c == '(': stack.append(len(stack) + 1) else: if stack: depth = stack.pop() depths.append(depth) xor = 0 for d in depths: xor ^= d print(0 if xor != 0 else 1)