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