import sys for line in sys.stdin: n = int(line) drink = 0 if n != 0: while n >= 3: drink += n//3 n = n//3+n%3 if n == 2: drink += 1 print(drink)