#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  scanf("%I64d", &N);
  int l = 1, r = 20000000, ans = 0;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if ((long long)mid * (mid + 1) < N * 2)
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  printf("%I64d", N - (long long)ans * (ans + 1) / 2);
  return 0;
}
