alls = []
while True:
try:
alls.append(int(input().strip()))
except EOFError:
break
for n in alls:
num = 0
if n > 0:
if n == 1:
print(0)
elif n == 2:
print(1)
else:
while True:
x = int(n / 3) # 商:表示可以兑换的瓶子数目
y = int(n % 3) # 余数,表示兑换后剩余的瓶子数目
num += x
n = x + y
if int(n) > 3:
continue
if int(n) == 3:
num += 1
break
elif int(n) == 2:
num += 1
break
else:
break
print(int(num))