#include<stdio.h>
int main(void)
{
	int a,x,i;
	while((scanf("%d",&a))!=EOF){
		x=0;
		for(i=0;i<a;i++){
			if((a-i)==1){
			}
			else if((a-i)%2!=0&&(a-i)%3!=0&&(a-i)%5!=0&&(a-i)%7!=0){
				x++;
			}
			else if((a-i)==2||(a-i)==3||(a-i)==5||(a-i)==7){
				x++;
			}
		}
		printf("%d\n",x);
	}
	return 0;
}