# your code goes here def m(nu): bi=format (nu,'b') C=0 for i in range (len (bi)): if bi[i]=="1": C+=1 # print("bi") # print (nu) return C N=int(input()) Nd=0 v=[0]*N v[0]=1 t=[[1]] i=0 while Nd<1: j=0 t.append([]) while j0: if v[mt-1]==0: # print (v) v[mt-1]=1 t[i+1].append(mt) j+=1 # print (t[i]) j-=len(t[i]) while j0: if v[mt-1]==0: t[i+1].append(mt) v[mt-1]=1 j+=1 # print (t) # print (i) if Nd<1 and t[i+1]==[]: Nd=2 i+=1 if N==1: p=1 elif Nd==1: p=len(t) else: p=-1 print (p)