s = input().strip() count = 0 n = len(s) i = 0 while i < n - 1: if s[i] == '(' and s[i+1] == ')': count += 1 i += 2 else: i += 1 print(0 if count % 2 else 1)