def water(n):
if n < 2:
return 0
elif n == 2:
return 1
else:
return water(n-2) + 1
while True:
n = int(input())
if n == 0:
break
else:
print(water(n))
if n < 2:
return 0
elif n == 2:
return 1
else:
return water(n-2) + 1
while True:
n = int(input())
if n == 0:
break
else:
print(water(n))