#include <bits/stdc++.h>
using namespace std;
long long brute(int n) {
  long long result = 0;
  for (int i = 1; i < n; ++i) {
    result = result + trunc(pow(n / i, 1.0 / 3)) - 1;
  }
  return result;
}
int maxx(int fd, int sd) { return (fd > sd) ? fd : sd; }
int minn(int fd, int sd) { return (fd < sd) ? fd : sd; }
vector<long long> cubes;
int bin_s2(long long n, int left, int right) {
  if (right - left <= 1)
    if (cubes[left] > n)
      return left;
    else
      return right;
  if (cubes[(left + right) / 2] <= n) {
    return bin_s2(n, (left + right) / 2 + 1, right);
  } else {
    return bin_s2(n, left, (left + right) / 2);
  }
}
long long calc(long long n) {
  int maxdeg = bin_s2(n, 0, 500000);
  long long result = 0;
  for (int i = 3; i <= maxdeg; ++i) {
    long long w = (long long)i;
    long long q = (long long)(i - 1);
    result = result + ((long long)i - 2) * (long long)(trunc(n / (q * q * q)) -
                                                       trunc(n / (w * w * w)));
  }
  return result;
}
long long bin_search(long long value, long long left, long long right) {
  long long newvalue = calc((left + right) / 2);
  if (right - left <= 1)
    if (newvalue == value)
      return left;
    else if (calc(right) == value)
      return right;
    else
      return -1;
  if (newvalue < value) {
    return bin_search(value, (left + right) / 2 + 1, right);
  } else {
    return bin_search(value, left, (left + right) / 2);
  }
}
int main() {
  long long m;
  scanf("%I64d", &m);
  for (int i = 0; i <= 1000000; ++i) {
    long long q = (long long)i;
    cubes.push_back(q * q * q);
  }
  long long answer = bin_search(m, 8, 4949101000000000);
  printf("%I64d", answer);
  return 0;
}
