#include <bits/stdc++.h>
void work() {
  long long int n;
  scanf("%I64d", &n);
  long long int sum = 1;
  int k = 1;
  while (sum < n) {
    k++;
    sum += k;
  }
  printf("%I64d\n", n - (sum - k));
  return;
}
int main() {
  work();
  return 0;
}
