N=int(input()) d = [] for i in range(1,21): res = 1 for j in range(1,i+1): res *= j d.append(res) if N in d: print(1) else: print(0)