#include <bits/stdc++.h>
int main() {
  long long n, m, i, r, x, y, j, t;
  scanf("%I64d", &n);
  m = n / 3;
  double sq1 = sqrt(m);
  long long sq = (long long)sq1;
  x = sq + 1;
  x *= 3;
  x *= sq;
  if (x > n) sq--;
  i = sq + 1;
  i *= 3;
  i *= sq;
  if (i == n) {
    x = 2 * sq;
    y = 0;
  } else {
    t = sq + 1;
    if (n < i + t) {
      y = 2;
      x = 1 + 2 * sq;
      j = n - i - 1;
      x -= j;
      y += 2 * j;
    } else if (n < i + 2 * t) {
      y = 2 * t;
      x = t;
      j = n - i - t;
      x -= 2 * j;
    } else if (n < i + 3 * t) {
      y = 2 * t;
      x = -t;
      j = n - i - 2 * t;
      x -= j;
      y -= 2 * j;
    } else if (n < i + 4 * t) {
      y = 0;
      x = -2 * t;
      j = n - i - 3 * t;
      x += j;
      y -= 2 * j;
    } else if (n < i + 5 * t) {
      y = -2 * t;
      x = -t;
      j = n - i - 4 * t;
      x += 2 * j;
    } else {
      y = -2 * t;
      x = t;
      j = n - i - 5 * t;
      x += j;
      y += 2 * j;
    }
  }
  printf("%I64d %I64d", x, y);
  return 0;
}
