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