a=[0,0,1,1]
n=int(input())
if n<=3:
    print(a[n])
else:
    for i in range(4,n+1):
        a.append(a[i-3]+2*a[i-2]+a[i-1])
    print(a[-1])