#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int dx2[] = {1, -1, 0, 0, -1, 1, -1, 1};
int dy2[] = {0, 0, 1, -1, 1, -1, -1, 1};
int read() {
  int x;
  scanf("%d", &x);
  return x;
}
int main() {
  long long n;
  cin >> n;
  long long ind = 1;
  long long x = 1;
  while (ind <= n) ind += x, x++;
  ind -= x - 1;
  long long y = 1;
  for (long long i = ind; i < n; i++, y++)
    ;
  cout << y;
  return 0;
}
