#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, sum = 0, c = 0;
  cin >> n;
  for (i = 1; sum < n; i++) sum += i;
  if ((sum + 1) == n)
    cout << 1;
  else {
    sum = sum + 1;
    while (sum != n) {
      sum--;
      c++;
    }
    cout << i - c;
  }
}
