a[610],i;main(n){for(scanf("%d",&i);--n+610;a[-n]=(a[~n]+a[-1-n]+!n)*2%1000);i=!printf("%d",a[(i-4)%600+4]+~i%2);}