H = input().strip() current_depth = 0 xor_sum = 0 for c in H: if c == '(': current_depth += 1 else: xor_sum ^= current_depth current_depth -= 1 print(0 if xor_sum != 0 else 1)