#pragma warning (disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

#define ll long long

#define REP(i, n) for(ll i = 0; i < n; i++)
#define SET(a) ll a = 0; (void)scanf("%lld", &a);

/*
ll cutLog(ll);
ll sum(ll);
*/

ll cutLogNew(ll);

int main() {
	SET(n);
	if (n == 1 || n == 2)printf("1");
	else printf("%lld", n - cutLogNew(n) + 1);
	return 0;
}

/*
ll cutLog(ll n) {
	ll ans;
	REP(i, n + 1) {
		if (sum(i + 1) > n + 1) {
			ans = i;
			break;
		}
	}
	return ans;
}

ll sum(ll n) {
	ll sum = 0;
	REP(i, n) {
		sum += (i + 1);
	}
	return sum;
}
*/

ll cutLogNew(ll n) {
	ll ans = 0;
	ll m = n + 1;
	REP(i, n) {
		m -= (i + 1);
		if (m < 0) {
			ans = i;
			break;
		}
	}
	return ans;
}
#include<bits/stdc++.h>
#define ll              long long int
#define ld              long double
#define ff              first
#define ss              second
#define mod             1000000007
#define ull             unsigned long long
#define vll             vector<ll>
#define uom             unordered_map
#define uos             unordered_set
#define pll             pair<ll, ll>
#define INF             9223372036854775807
#define w(t)            ll tests;    cin>>tests;        while(tests--)
#define endl            "\n"
#define pb(x)           push_back(x)
#define ppb()            pop_back()
#define all(x)          x.begin(), x.end()
#define mp(a, b)        make_pair(a, b)
#define setp(x, y)      fixed << setprecision(x) << y
#define f(i, a, b)      for(ll i = a ; i < b ; i++)
#define fo(j, a, b)     for(ll j = a ; j >= b ; j--)
#define fill(a, n, x)   f(i, 0, n)     a[i]=x;
using namespace std;

void init() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main() {

    init();
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll x;
    cin >> x;

    if (x < 0)
        x = 0;

    cout << x;

    return 0;
}