a=N=input()+1;l,c,r=[1],0,{} while cb),l][i in r];r[i]=1 print[-1,a][a