#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long st = 0, en = 1e9 + 1;
  long long j = 0ll;
  while (st <= en) {
    long long mid = (st + en) / 2;
    if (mid * (mid + 1) / 2 < n) {
      j = mid;
      st = mid + 1;
    } else
      en = mid - 1;
  }
  cerr << "j"
       << " : " << j << endl;
  ;
  cout << n - (j * (j + 1) / 2) << endl;
}
