#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long rt = sqrt(2 * n);
  long long x = rt * (rt + 1) / 2;
  if (n == x) {
    cout << rt;
    return 0;
  }
  if (n < x) rt--;
  x = rt * (rt + 1) / 2;
  cout << n - x;
}
