def count_units(s): stack_depth = 0 count = 0 for c in s: if c == '(': stack_depth += 1 else: stack_depth -= 1 if stack_depth == 0: count += 1 return count H = input().strip() units = count_units(H) if units % 2 == 1: print(0) else: print(1)