#include <bits/stdc++.h>
using namespace std;
long long n;
long long x = 0, y = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  long long k = n;
  k = 1ll * k * 4;
  k += 3;
  k /= 3;
  k = sqrt(k);
  k -= 1;
  k /= 2;
  x = 2 * k, y = 0;
  n -= 1ll * 3 * k * (k + 1);
  if (n) x += 1, y += 2, n--;
  if (n >= k)
    x -= k, y += 2 * (k), n -= k;
  else
    while (n) x -= n, y += 2 * n, n = 0;
  if (n >= k + 1)
    x -= 2 * (k + 1), n -= k + 1;
  else
    while (n) x -= 2 * n, n = 0;
  if (n >= k + 1)
    x -= k + 1, y -= 2 * (k + 1), n -= k + 1;
  else
    while (n) x -= n, y -= 2 * n, n = 0;
  if (n >= k + 1)
    x += k + 1, y -= 2 * (k + 1), n -= k + 1;
  else
    while (n) x += n, y -= 2 * n, n = 0;
  if (n >= k + 1)
    x += 2 * (k + 1), n -= k + 1;
  else
    while (n) x += 2 * n, n = 0;
  if (n >= k + 1)
    x += k + 1, y += 2 * (k + 1), n -= k + 1;
  else
    while (n) x += n, y += 2 * n, n = 0;
  cout << x << ' ' << y;
  return 0;
}
