#include <bits/stdc++.h>
int main() {
  unsigned long long n, k, m;
  scanf("%I64d", &n);
  k = ((unsigned long long)sqrt(n * 8 + 1) - 1LL) / 2LL;
  m = k * (k + 1) / 2LL;
  if (m == n)
    printf("%I64d", k);
  else
    printf("%I64d", n - m);
  return 0;
}
