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