#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, d = 1;
  cin >> n;
  while (n) {
    if (n > d) {
      n -= d;
      d++;
    } else
      return cout << n << endl, 0;
  }
}
