#include <bits/stdc++.h>
using namespace std;
long long rec[20000000];
int main() {
  long long n, sum;
  memset(rec, 0, sizeof(rec));
  for (int i = 1; i < 20000000; ++i) rec[i] = i + rec[i - 1];
  while (~scanf("%I64d", &n)) {
    int i;
    sum = 0;
    for (i = 1; i < 20000000; ++i) {
      if (rec[i] > n) break;
    }
    n = n - rec[i - 1];
    if (n == 0) n = i - 1;
    printf("%I64d\n", n);
  }
  return 0;
}
