#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ll n;
    cin >> n;

    double t = (double)(n + 1);
    t = sqrt(2 * t + 0.25) - 0.5;
    int m = 10000;
    ll x = (ll)t + m;

    for (int i = 0; i < m * 2; i++) {
        ll s = x * (x + 1) / 2;
        if (x * (x + 1) / 2 <= n + 1) break;
        x--;
    }

    cout << n + 1 - x << endl;

    return 0;
}
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    long long n;
    cin >> n;
    long long k = (long long)floor(sqrt(2 * n + (long double)2.25) - (long double)0.5);
    long long result = n - k + 1;
    cout << result << endl;
}