#include <bits/stdc++.h>
using namespace std;
long long arr[15000000];
int main() {
  long long int n, p, q, i, j, x, k, c;
  c = 0;
  for (i = 1;; i++) {
    c += i;
    arr[i] = c;
    if (c > 100000000001000) break;
  }
  cin >> n;
  for (i = 0;; i++) {
    if (n > arr[i] && n <= arr[i + 1]) {
      if (n == arr[i + 1]) {
        x = i + 1;
      } else if (n < arr[i + 1]) {
        p = arr[i + 1] - n;
        x = i + 1 - p;
      }
      break;
    }
  }
  cout << x << endl;
  return 0;
}
