#include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
  scanf("%I64d", &n);
  long long i = 1, Rec = 0;
  while (Rec + i < n) {
    Rec = Rec + i;
    i++;
  }
  printf("%I64d\n", n - Rec);
  return 0;
}
