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