#include <bits/stdc++.h>
using namespace std;
const long long M = (long long)1e9;
int main() {
  long long n, low = -1, high, temp1, temp2;
  cin >> n;
  if (n == 0) {
    cout << 0 << ' ' << 0 << endl;
    return 0;
  }
  high = min(n, M);
  while (high - low > 1) {
    long long mid = (low + high) / 2;
    if (3 * mid * (mid + 1) > n)
      high = mid;
    else
      low = mid;
  }
  temp1 = n - 3 * low * (low + 1);
  temp2 = temp1 % (low + 1);
  temp1 /= low + 1;
  if (temp1 == 0) {
    if (temp2 == 0)
      cout << 2 * low << ' ' << 0 << endl;
    else
      cout << 2 * (low + 1) - temp2 << ' ' << temp2 * 2 << endl;
  }
  if (temp1 == 1) cout << low + 1 - temp2 * 2 << ' ' << (low + 1) * 2 << endl;
  if (temp1 == 2)
    cout << -low - 1 - temp2 << ' ' << (low + 1) * 2 - temp2 * 2 << endl;
  if (temp1 == 3) cout << -(low + 1) * 2 + temp2 << ' ' << -temp2 * 2 << endl;
  if (temp1 == 4) cout << -low - 1 + temp2 * 2 << ' ' << -(low + 1) * 2 << endl;
  if (temp1 == 5)
    cout << low + 1 + temp2 << ' ' << -(low + 1) * 2 + temp2 * 2 << endl;
  return 0;
}
