#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k = 1, tot = 1;
  cin >> n;
  while (tot < n) {
    k++;
    tot += k;
  }
  long long int x = tot - n;
  cout << k - x << endl;
  return 0;
}
