#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int main() {
  long long n;
  scanf("%lld", &n);
  long long pos = 1;
  for (long long i = 1; i < n; i++) {
    if (i * (i + 1) / 2 <= n && (i + 1) * (i + 2) / 2 > n) {
      pos = i;
      break;
    }
  }
  long long sum = (1 + pos) * pos / 2;
  sum = n - sum;
  if (sum == 0) sum = pos;
  printf("%lld\n", sum);
  return 0;
}
