The kangaroo starts at coordinate 0 on an infinite number line. At each time step, it can stay in place or jump left or right by a distance equal to the current time step. The goal is to find the earliest time the kangaroo can reach a specific coordinate X on the number line. The input is the value of X, and the output should be the earliest possible time for the kangaroo to reach coordinate X. The constraints are that X is an integer and 1 ≤ X ≤ 10^9.

# Buggy version:
x = int(input())

n = int((2*x)**0.5)

for i in range(n, n+3):
    if i*(i+1) > x*2:
        print(i)
        exit()

# Fixed version:
x = int(input())

n = int((2*x)**0.5)

for i in range(n, n+3):
    if i*(i+1) >= x*2:
        print(i)
        exit()

# Buggy version:
x = int(input())
i = 0
while x>0
  i = i+1
  x = x-i
print(i)

# Fixed version:
x = int(input())
i = 1
while x > 0:
    x -= i
    i += 1
print(i-1)

# Buggy version:
n = int(input())
i = 1
while n > 0:
  n -= i
  i += 1
print(i)

# Fixed version:
n = int(input())
i = 1
while n > 0:
    n -= i
    i += 1
i -= 1
print(i)

# Buggy version:
n = int(input())
import sys
for i in range(1,n):
    if i*(i+1)/2 >= n:
        print(i)
        sys.exit()

# Fixed version:
n = int(input())
import sys
if n == 1:
    print(1)
    sys.exit()
for i in range(1,n**2):
    if round(i*(i+1)/2) >= n:
        print(i)
        sys.exit()

# Buggy version:
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../Documents/input.txt'))
	#print(name)
	sys.stdin = open(name)

x = int(input())
chk = 0
i = 1

while chk < x:
	chk = chk + i
	i = i + 1
	print(chk,i)

print(i-1)


# Fixed version:
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../Documents/input.txt'))
	#print(name)
	sys.stdin = open(name)

x = int(input())
chk = 0
i = 1

while chk < x:
	chk = chk + i
	i = i + 1
	#print(chk,i)

print(i-1)

# Buggy version:
X=int(input())
i=1
sum1=1
while sum<X:
  i+=1
  sum1=sum1+i
print(i)


# Fixed version:
X=int(input())
i=1
sum1=1
while sum1<X:
  i+=1
  sum1=sum1+i
print(i)

# Buggy version:
x = int(input())

t = (-1 + math.sqrt(1 + 8 * x))
if t % 2 == 0:
  print(t//2)
else:
  print(t//2+1)


# Fixed version:
import math
x = int(input())

t = (-1 + math.sqrt(1 + 8 * x))
if t % 2 == 0:
  print(int(t)//2)
else:
  print(int(t)//2+1)

# Buggy version:
x=int(input())
for i in range(1,x):
	if (i+1)*i*0.5>=x:
		print(i)
		break

# Fixed version:
x=int(input())
for i in range(1,10**9+1):
	if (i+1)*i*0.5>=x:
		print(i)
		break

# Buggy version:
X = int(input())
for i in range(1, X):
	if i * (i - 1) / 2 < X <= i * (i + 1) / 2:
		print(i)
		exit()


# Fixed version:
X = int(input())
for i in range(1, X + 1):
	if i * (i - 1) / 2 < X <= i * (i + 1) / 2:
		print(i)
		exit()

# Buggy version:
import math
x = int(input())
print(-(-((x*2+1/4)**0.5-1/2)//1))

# Fixed version:
import math
x = int(input()) * 2
ans = math.ceil((-1 + (1+4*x) ** 0.5) / 2)
print(ans)

# Buggy version:
n=int(input())
tmp=0
for i in range(100000):
  tmp+=i
  if tmp>=n:
    print(i)

# Fixed version:
n=int(input())
tmp=0
for i in range(100000):
  tmp+=i
  if tmp>=n:
    print(i)
    break

# Buggy version:
N=int(input())
a=0
i=1
while a<N:
  a+=i
  i+=1
print(i)
  

# Fixed version:
N=int(input())
a=0
i=0
while a<N:
  i+=1
  a+=i
print(i)

# Buggy version:
n=int(input())
ans=0
for i in range(n+1):
    if i*(i+1)/2>n:
        ans=i
        break
print(ans)


# Fixed version:
n=int(input())
ans=0
for i in range(n+1):
    if i*(i+1)/2>=n:
        ans=i
        break
print(ans)

# Buggy version:
x=int(input())
for i in range(100000):
  if i * i+1 >= 2 * x:
    print(i)
    quit()

# Fixed version:
x=int(input())
for i in range(100000):
  if i * (i+1) >= 2 * x:
    print(i)
    quit()

# Buggy version:
X = int(input())

for i in range(1,X):
    if(i*(i+1)//2>=X):
        print(i)
        exit()

# Fixed version:
X = int(input())
for i in range(1, 100000):
    if i*(i+1)/2 >= X:
        print(i)
        exit(0)

# Buggy version:
x = input()
d = 0
for i in range(1, 10 ** 6):
  d += i
  if x <= d:
    print(i)
    break




# Fixed version:
x = int(input())
d = 0
for i in range(1, 10 ** 6):
    d += i
    if x <= d:
        print(i)
        break