#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
const long long MOD = 1e9 + 7;
const double eps = 1e-7;
int N, M, K, Q, T;
long long gcd(long long a, long long b) {
  if (b == 0LL) return a;
  return gcd(b, a % b);
}
int main() {
  int i, j;
  long long x;
  scanf("%lld", &x);
  long long l = 1LL;
  long long r = (long long)1e8;
  long long ans = -1LL;
  while (l <= r) {
    long long m = (l + r) >> 1;
    long long num = (m + 1LL) * m / 2LL;
    if (x <= num) {
      ans = m;
      r = m - 1;
    } else {
      l = m + 1;
    }
  }
  --ans;
  long long num = (ans + 1LL) * ans / 2LL;
  x -= num;
  printf("%lld", x);
  return 0;
}
