#include <bits/stdc++.h>
using namespace std;
void solve();
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int T = 1;
  while (T--) {
    solve();
    cout << "\n";
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << "secs"
       << "\n";
  return 0;
}
void solve() {
  long long int n;
  cin >> n;
  long long int x = 1;
  long long int a;
  while (true) {
    a = ((x + 1) * (x)) / 2;
    if (a == n) {
      cout << x;
      return;
    }
    if (a > n) {
      break;
    }
    x++;
  }
  x--;
  cout << n - (((x + 1) * (x)) / 2);
}
