#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long num(long long inx) { return (inx * (inx + 1)) / 2; }
int main() {
  ios::sync_with_stdio(0);
  long long N;
  cin >> N;
  N--;
  long long l = 0, h = 1e8;
  long long res = 0;
  while (l <= h) {
    long long mid = (l + h) / 2;
    if (num(mid) <= N) {
      res = mid;
      l = mid + 1;
    } else
      h = mid - 1;
  }
  cout << N - num(res) + 1;
  return 0;
}
