a['~~'],*p,s=2e3,n,k;main(j){for(*a=scanf("%d",&n);s--;)for(p=a;!(k&=k-1)?j=!*p||(!p[j]|p[j]>*p?p[j]=1+*p:0,!p[-j]|p[-j]>*p?p[-j]=1+*p:1),k=++p-a,k*=k