#include <bits/stdc++.h>
using namespace std;
string st;
long long t, n, x[49];
bool ok;
int main() {
  long long dr2 = 0, dr1 = 1, x = 0, y = 0;
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  long long k = n / 3;
  k = sqrt(k);
  while ((k * (k + 1)) > (n / 3)) k--;
  while (((k + 1) * (k + 2)) < (n / 3)) k++;
  dr1 = k + 1;
  dr2 = k;
  x = k * 2;
  n -= k * (k + 1) * 3;
  if (n > 0) {
    n--;
    x++;
    y += 2;
  }
  if (n >= dr2) {
    n -= dr2;
    x -= dr2;
    y += 2 * dr2;
  } else {
    x -= n;
    y += 2 * n;
    ok = 1;
  }
  if (n >= dr1 && ok == 0) {
    n -= dr1;
    x -= 2 * dr1;
  } else if (ok == 0) {
    x -= 2 * n;
    ok = 1;
  }
  if (n >= dr1 && ok == 0) {
    n -= dr1;
    x -= dr1;
    y -= 2 * dr1;
  } else if (ok == 0) {
    x -= n;
    y -= 2 * n;
    ok = 1;
  }
  if (n >= dr1 && ok == 0) {
    n -= dr1;
    x += dr1;
    y -= 2 * dr1;
  } else if (ok == 0) {
    x += n;
    y -= 2 * n;
    ok = 1;
  }
  if (n >= dr1 && ok == 0) {
    n -= dr1;
    x += 2 * dr1;
  } else if (ok == 0) {
    x += 2 * n;
    ok = 1;
  }
  if (ok == 0) {
    x += n;
    y += 2 * n;
    ok = 1;
  }
  cout << x << " " << y;
}
