#include <bits/stdc++.h>
#include <chrono>
using namespace std;

using _i64 = int64_t;
using _u64 = uint64_t;
using _f64 = double;

#define _for(i, start, end) for(_i64 i = (_i64)start; i < (_i64)end; ++i)
#define _rep(i, number) _for(i, 0, number)
#define _foreach(e, data) for(auto& e : data)
#define _all(data) data.begin(), data.end()

template<typename type>
_i64 _size(const type& data) { return static_cast<_i64>(data.size()); }
template<typename type, size_t size>
_i64 _size(const type (&)[size]) { return static_cast<_i64>(size); }

enum _flag : bool { able = true, disable = false };

struct _time {
    _time(_flag flag) { check = flag; if(!check) { return; } gettime(start); }
    ~_time() {
        if(!check) { return; }; gettime(end);
        _i64 elapse = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cout << endl << "Time: " << elapse << " ms" << endl;
    }
    private:
    using _timer = chrono::time_point<chrono::system_clock>;
    _timer start, end; bool check;
    void gettime(_timer& time) { time = chrono::system_clock::now(); }
};

struct _ini { _ini() { ios::sync_with_stdio(false); cin.tie(nullptr); } } _ini;

_i64 _gcd(_i64 a, _i64 b) {
    return (max(a, b) % min(a, b) != 0 ? _gcd(min(a, b), max(a, b) % min(a, b)) : min(a, b));
}

int main() {
    {
        _time time(disable);
        _i64 n;
        vector<_i64> ans(1000000);
        ans[1] = 0; ans[2] = 1; ans[3] = 2; ans[4] = 2;
        for(_i64 i = 5; i < 1000000; i += 6) {
            for(_i64 j = 3; j <= sqrt(i) + DBL_EPSILON; j += 2) {
                if(i % j == 0) { ans[i] = ans[i - 1]; break; }
            }
            if(!ans[i]) { ans[i] = ans[i - 1] + 1; }
            ans[i + 1] = ans[i];
            for(_i64 j = 3; j <= sqrt(i + 2) + DBL_EPSILON; j += 2) {
                if((i + 2) % j == 0) { ans[i + 2] = ans[i + 1]; break; }
            }
            if(!ans[i + 2]) { ans[i + 2] = ans[i + 1] + 1; }
            ans[i + 3] = ans[i + 2];
            ans[i + 4] = ans[i + 3];
            ans[i + 5] = ans[i + 4];
        }
        while(cin >> n) { cout << ans[n] << endl; }
    }
    return 0;
}
