#import int n,r,i,ii,j,x;main(){for(std::cin>>n;i<=n;r+= ii!=1 ==5-x,ii=++i,x=1)for(j=1;x&&++j*j