#include <bits/stdc++.h>
using namespace std;
long long fak(long long k) {
  long long u = 1;
  for (int i = 1; i <= k; i++) {
    u = u * i;
  }
  return u;
}
int main() {
  long long n = 0, k = 1;
  cin >> n;
  while (n > 0) {
    n -= k;
    if (n > 0) k++;
  }
  n = n + k;
  cout << n;
  for (int i = 1; i <= k; i++) {
    if (n == 0) {
      cout << i;
      break;
    } else if ((n + i - 1) == 0) {
      cout << i - 1;
      break;
    }
  }
}
