#include <bits/stdc++.h>
int main() {
  long long int u, o = 1, s = 0, y = 1;
  scanf("%llu", &u);
  while (o == 1) {
    s += y;
    if (s == u) {
      printf("%lld", y);
      o = 0;
    } else if (s > u) {
      o = 0;
      printf("%lld", y - (s - u));
    }
    y++;
  }
  return 0;
}
