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