#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k = 0;
  int j, t;
  scanf("%I64d", &n);
  if (n == 1) {
    printf("1");
    return 0;
  }
  for (long long int i = 1; i <= n; i++) {
    t = k;
    k = k + i;
    if (n < k) {
      j = n - t;
      if (j != 0) {
        printf("%d", j);
        break;
      } else {
        j = i - 1;
        printf("%d", j);
        break;
      }
    }
  }
}
