#include using namespace std; typedef unsigned u32; u32 count(u32 n) { if (n < 2) { return 0; } u32 v = sqrt(n); vector scnt(v + 1), lcnt(v + 1); for (u32 i = 1; i <= v; ++i) { scnt[i] = i - 1; } for (u32 i = 1; i <= v; ++i) { lcnt[i] = n / i - 1; } assert(lcnt[1] == n - 1); for (u32 p = 2; p <= v; ++p) { if (scnt[p] == scnt[p - 1]) { continue; } u32 q = p * p, c = scnt[p - 1]; u32 w = v / p, e = min(v, n / q), m = n / p; for (u32 i = 1; i <= w; ++i) { lcnt[i] -= lcnt[i * p] - c; } for (u32 i = w + 1; i <= e; ++i) { lcnt[i] -= scnt[m / i] - c; } for (u32 i = v; i >= q; --i) { scnt[i] -= scnt[i / p] - c; } } u32 ret = scnt[cbrt(n)]; for (u32 i = 2; i <= v; ++i) { if (scnt[i] != scnt[i - 1]) { ret += lcnt[i] - scnt[i]; } } return ret; } int main() { u32 n; scanf("%u", &n); u32 lo = 1, hi = 5150000, ans = 0; while (lo <= hi) { u32 mi = (lo + hi) >> 1; if (count(mi) < n) { lo = mi + 1; } else { ans = mi; hi = mi - 1; } } printf("%d\n", ans); return 0; }