#include <bits/stdc++.h>
using namespace std;
int min(int x, int y) { return (x < y) ? x : y; }
int max(int x, int y) { return (x > y) ? x : y; }
long long a[14142136];
int main(int argc, char const *argv[]) {
  for (int i = 1; i <= 14142136; i++) a[i] += a[i - 1] + i;
  long long x;
  scanf("%I64d", &x);
  long long lo = 1, hi = 14142136, mid;
  while (lo < hi) {
    mid = lo + (hi - lo + 1) / 2;
    if (a[mid] <= x)
      lo = mid;
    else
      hi = mid - 1;
  }
  if (x - a[lo])
    printf("%I64d\n", x - a[lo]);
  else
    printf("%I64d\n", lo);
  return 0;
}
