#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, left = 1, right = 100000000, mid;
  cin >> n;
  while (right > left) {
    mid = left + (right - left) / 2;
    if (((mid + 1) * mid) / 2 < n)
      left = mid + 1;
    else
      right = mid;
  }
  long long ans;
  ans = n - ((left - 1) * left) / 2;
  cout << ans << "\n";
  return 0;
}
