#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
T div_floor(const T a, const T b) {
  return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(const T a, const T b) {
  return a >= 0 ? (a - 1) / b + 1 : a / b;
}
constexpr long long mod = 1e9 + 7;
constexpr long long INF = mod * mod;
constexpr int MAX = 100010;
int main() {
  long long n;
  scanf("%lld", &n);
  long long low = 0, high = mod;
  while (high - low > 1) {
    long long mid = (high + low) / 2;
    (mid * (mid + 1) / 2 >= n ? high : low) = mid;
  }
  printf("%lld\n", n - low * (low + 1) / 2);
}
