#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,i=0,j;
	cin>>n;
	for(j=1;j<=n;j++){
		if(j%3==2&&j%5==3&&j%7==2) i++;
	} 
	cout<<i;
}
/**************************************************************
	Problem: 1055
	User: linzihang
	Language: C++
	Result: Accepted
	Time:7 ms
	Memory:2072 kb
****************************************************************/