#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int x;
int ans=1e9,res;
int main()
{
	scanf("%d",&x);
	for(int i=1;i<=sqrt(x)*2;i++)
	{
		if(i*(i+1)/2<=x)
		{
			res=i;
			int lst=x-(i*(i+1))/2;
			if(lst>i){
				res+=lst-i;
				ans=min(ans,res);
			}			
		}
		else break; 
	}
	cout<<ans<<endl;
	return 0;
}