#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long ans(0);
  while (ans <= n) n -= ans++;
  if (n == 0)
    cout << ans - 1;
  else
    cout << n;
  return 0;
}
