#include <stdio.h>
bool used[1000005];int RideBack[79000],last=0;
int bin_search(int val) {int left=0,right=last-1,ans=0;while (left<=right) {int center=(left+right)>>1;if (RideBack[center]>val) right=center-1;else left=center+1,ans=left;} return ans;}
int main() {
    int i;for (i=2;i<=1000000;used[i++]=true);
    for (i=2;i<=1000;i++) if (used[i]) for (int j=i*i;j<=1000000;j+=i) used[j]=false;
    for (i=2;i<=1000000;i++) if (used[i]) RideBack[last++]=i;
    while (scanf("%d",&i)!=EOF) printf("%d\n",bin_search(i));return 0;
}