#include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  long long t = 1;
  while (n > t) {
    n -= t;
    t++;
  }
  cout << n << endl;
}
