#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
long long cal(long long x) { return (x + 1) * x / 2; }
int main() {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  long long l = 0, r = 1e8, ans = -1;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (cal(mid) < n)
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  cout << n - cal(ans) << '\n';
  return 0;
}
