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