#include <map>  
#include <cmath>  
#include <ctime>  
#include <deque>  
#include <queue>  
#include <stack>  
#include <cctype>  
#include <cstdio>  
#include <string>  
#include <vector>  
#include <climits>  
#include <cstdlib>  
#include <cstring>  
#include <fstream>  
#include <iomanip>  
#include <numeric>  
#include <sstream>  
#include <utility>  
#include <iostream>  
#include <algorithm>  

using namespace std; 

class AliceGameEasy { 
public: 
   long long findMinimumValue( long long x, long long y )  
   { 
     	long long sum = x + y; 
     	long long root = (long long) sqrt(1 + 8 * sum); 

     	if(root * root != 1 + 8 * sum) 
       		return -1; 

     	long long round = (-1 + root) / 2; 
     	long long sol = 0; 
     	long long s = 0; 

     	if(round == 0 || x == 0) 
       		return 0; 

     	for(int i=round;i>=1;i--) 
     	{ 
      		if(s + i >= x) 
        		return sol + 1; 
      	else 
      	{ 
        	s += i; 
        	sol ++; 
      	} 
     }
     return -1; 
   } 
};

int main() 
{
	AliceGameEasy obj;
	cout << obj.findMinimumValue( 0, 1) << endl;
	return 0;
}