#include <bits/stdc++.h>
using namespace std;
long long formula(long long n) { return n * (n + 1) / 2; }
int main() {
  long long n;
  cin >> n;
  long long start = 0;
  long long end = sqrt(n) + 1;
  long long mid = 0;
  while (start + 1 < end) {
    mid = start + (end - start) / 2;
    if (formula(mid) < n) {
      start = mid + 1;
    } else if (formula(mid) > n) {
      end = mid;
    } else {
      cout << mid;
      return 0;
    }
  }
  while (formula(mid) > n) {
    mid--;
  }
  while (formula(mid + 1) < n) {
    mid++;
  }
  cout << n - (formula(mid));
}
