#include <bits/stdc++.h>
using namespace std;
int main() {
  bool x = true;
  long long n, sum = 0;
  cin >> n;
  for (int i = 1; x; i++) {
    sum = sum + i;
    if (n == sum) {
      cout << i << endl;
      x = false;
    } else if (n < sum) {
      for (int j = i; j >= 1; j--) {
        if (sum == n) {
          cout << j << endl;
          x = false;
        }
        sum--;
      }
    }
  }
  return 0;
}
