#include <bits/stdc++.h>
template <typename T>
bool domax(T &a, T b) {
  return (b > a ? (a = b, true) : false);
}
template <typename T>
bool domin(T &a, T b) {
  return (b < a ? (a = b, true) : false);
}
long long N;
long long f(long long a) { return (a * (a + 1)) / 2; }
int main() {
  scanf("%lld", &N);
  long long lo = 1, hi = 1e8;
  while (lo < hi) {
    long long mid = (lo + hi) / 2;
    if (f(mid) < N)
      lo = mid + 1;
    else
      hi = mid;
  }
  printf("%lld\n", lo - (f(lo) - N));
}
