include<string>
using namespace std;

int main(){
    int N;
    cin >> N;
    int counter = 0;
    for(int i = 0;i<N+1; i++){
        if((i%3 != 0)&&(i%5 != 0)) ++counter;
    }
    cout << counter << endl;
}