#include <bits/stdc++.h>
using namespace std;
const long long mo = 1000000007;
long long n, l, r, m;
int main() {
  cin >> n;
  if (n == 1) {
    cout << 1;
    return 0;
  }
  l = 0;
  while (l * (l + 1) / 2 < n) {
    l++;
  }
  cout << n - (l - 1) * l / 2;
  return 0;
}
