#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e7 + 10;
int main() {
  long long n;
  cin >> n;
  long long a = (sqrt(1 + 8 * n) - 1) / 2;
  if (a * (a + 1) / 2 == n) {
    cout << a << endl;
  } else {
    cout << n - (a * (a + 1) / 2) << endl;
  }
  return 0;
}
