//求测试
#include<iostream>
using namespace std;
long long maxlimt = 1E18 + 2;
int _tmain(int argc, _TCHAR* argv[])
{
long long num;
while (cin >> num &&1 <= num&&num <= maxlimt)
{
long long x = sqrt(1 + 8 * num) / 2;
long long temp;
if (x % 2 == 0)
temp = (x / 2 * (x + 1));
else
temp = (x + 1)*((x - 1) / 2) + (x-1) / 2 + 1;
if (temp < num)
{
while (temp<=num)
{
x++;
temp = temp + x;
}
}
if (temp - num>x)
x--;
cout << x << endl;
}
return 0;
}