Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y.

In a single second, he can modify the length of a single side of the current triangle such that it remains a non-degenerate triangle (triangle of positive area). At any moment of time, the length of each side should be integer.

What is the minimum number of seconds required for Memory to obtain the equilateral triangle of side length y?


-----Input-----

The first and only line contains two integers x and y (3 ≤ y < x ≤ 100 000) — the starting and ending equilateral triangle side lengths respectively.


-----Output-----

Print a single integer — the minimum number of seconds required for Memory to obtain the equilateral triangle of side length y if he starts with the equilateral triangle of side length x.


-----Examples-----
Input
6 3

Output
4

Input
8 5

Output
3

Input
22 4

Output
6



-----Note-----

In the first sample test, Memory starts with an equilateral triangle of side length 6 and wants one of side length 3. Denote a triangle with sides a, b, and c as (a, b, c). Then, Memory can do $(6,6,6) \rightarrow(6,6,3) \rightarrow(6,4,3) \rightarrow(3,4,3) \rightarrow(3,3,3)$.

In the second sample test, Memory can do $(8,8,8) \rightarrow(8,8,5) \rightarrow(8,5,5) \rightarrow(5,5,5)$.

In the third sample test, Memory can do: $(22,22,22) \rightarrow(7,22,22) \rightarrow(7,22,16) \rightarrow(7,10,16) \rightarrow(7,10,4) \rightarrow$

$(7,4,4) \rightarrow(4,4,4)$.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Mathematics

Greedy algorithms


Solutions:
(x, y) = list(map(int, input().split()))
if x > y:
	(x, y) = (y, x)
a = x
b = x
c = x
ans = 0
while not a == b == c == y:
	if a <= b and a <= c:
		a = min(b + c - 1, y)
	elif b <= a and b <= c:
		b = min(a + c - 1, y)
	elif c <= a and c <= b:
		c = min(a + b - 1, y)
	ans += 1
print(ans)


(n, m) = list(map(int, input().split()))
s = [m, m, m]
ans = 0
while s[0] < n:
	val = min(n, s[1] + s[2] - 1)
	s[0] = s[1]
	s[1] = s[2]
	s[2] = val
	ans += 1
print(ans)


(x, y) = list(map(int, input().split()))
s = [y, y, y]
k = 0
while sum(s) != x * 3:
	minn = min(s)
	maxx = max(s)
	sr = sum(s) - maxx - minn
	a = sum([sr, maxx]) - 1
	if a > x:
		a = x
	s[s.index(minn)] = a
	k += 1
print(k)


(x, y) = map(int, input().split())
t = 0
ba = y
bb = y
bc = y
while True:
	if ba >= x and bb >= x and (bc >= x):
		print(t)
		break
	t += 1
	if t % 3 == 1:
		ba = bb + bc - 1
	if t % 3 == 2:
		bb = ba + bc - 1
	if t % 3 == 0:
		bc = ba + bb - 1


(t, f) = map(int, input().split())
s = [f] * 3
count = 0
while sum(s) < 3 * t:
	s.sort()
	s[0] = min(t, s[1] + s[2] - 1)
	count += 1
print(count)


(x, y) = map(int, input().split())
(x, y) = (y, x)
A = x
B = x
curr = x
count = 0
while curr < y:
	curr = B + A - 1
	(A, B) = (B, curr)
	count += 1
count += 2
print(count)


(x, a) = map(int, input().split())
c = b = a
i = 0
while a < x:
	[a, b, c] = sorted([b, c, c + b - 1])
	i += 1
print(i)


(x, y) = map(int, input().split())
a = [y, y, y]
count = 0
while not all(map(lambda _: _ == x, a)):
	a[0] = min(a[1] + a[2] - 1, x)
	a.sort()
	count += 1
print(count)


3

def transform(a, b, c, y):
	ans = 0
	while True:
		if a == b == c == y:
			return ans
		(a, b, c) = sorted([a, b, c], reverse=True)
		c = min(a + b - 1, y)
		ans += 1
(x, y) = list(map(int, input().split()))
print(transform(y, y, y, x))


def solve(x: int, y: int) -> int:
	s1 = s2 = s3 = y
	time = 0
	while s1 < x:
		s1 = min(s2 + s3 - 1, x)
		(s1, s2, s3) = sorted([s1, s2, s3])
		time += 1
	return time
(x, y) = list(map(int, input().split()))
print(solve(x, y))


(x, y) = map(int, input().split())
N = 3
L = N * [y]
y = i = 0
while x > L[i]:
	j = (1 + i) % N
	L[i] = L[(i - 1) % N] - 1 + L[j]
	i = j
	y += 1
print(y)


def f(n, m):
	ans = 0
	t = [m] * 3
	while t != [n] * 3:
		t = sorted(t[1:] + [min(t[1] + t[2] - 1, n)])
		ans += 1
	return ans

def g(n, m):
	ans = 0
	t = [n] * 3
	while t != [m] * 3:
		t = sorted(t[:2] + [max(t[1] - t[0] + 1, m)])
		ans += 1
	return ans
(n, m) = map(int, input().split())
print(min(f(n, m), g(n, m)))


a = input().split()
s = 0
i = j = k = int(a[1])
while i <= int(a[0]):
	s += 1
	k = j
	j = i
	i = i + k - 1
print(s + 2)


eKnBQaHTzrUcYtwjiVCG = map
eKnBQaHTzrUcYtwjiVCo = int
eKnBQaHTzrUcYtwjiVCX = input
eKnBQaHTzrUcYtwjiVCA = sorted
eKnBQaHTzrUcYtwjiVCN = min
eKnBQaHTzrUcYtwjiVCF = print
(x, y) = eKnBQaHTzrUcYtwjiVCG(eKnBQaHTzrUcYtwjiVCo, eKnBQaHTzrUcYtwjiVCX().split())
(a, b, c) = (y, y, y)
k = 0
while a != x:
	(a, b, c) = eKnBQaHTzrUcYtwjiVCA([eKnBQaHTzrUcYtwjiVCN(x, b + c - 1), b, c])
	k += 1
eKnBQaHTzrUcYtwjiVCF(k)


import sys, os, io
from sys import stdin
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def fun(a, x):
	if min(a) >= x:
		return 1
	return 0
for _ in range(1):
	(x, y) = li()
	a = [y, y, y]
	f = 0
	cnt = 0
	while fun(a, x) == 0:
		if f == 0:
			sum2 = a[1] + a[2] - a[0]
			a[0] += sum2 - 1
		elif f == 1:
			sum2 = a[0] + a[2] - a[1]
			a[1] += sum2 - 1
		else:
			sum2 = a[1] + a[0] - a[2]
			a[2] += sum2 - 1
		f += 1
		f %= 3
		cnt += 1
	print(cnt)


(n, m) = map(int, input().split())
a = [m, m, m]
ans = 0
while a != [n, n, n]:
	for i in range(3):
		if a[i] != n:
			a[i] = min(n, a[(i + 1) % 3] + a[(i + 2) % 3] - 1)
			ans += 1
print(ans)


def get_next(T):
	[a, b, c] = sorted(T)
	return [b, c, b + c - 1]

def __starting_point():
	(y, x) = [int(a) for a in input().split()]
	T = [x, x, x]
	i = 0
	while max(T) < y:
		T = get_next(T)
		i += 1
	print(2 + i)
__starting_point()


from sys import stdin
(x, y) = map(int, stdin.readline().rstrip().split())
a = b = c = y
count = 0
while a < x:
	temp = b + c - 1
	a = b
	b = c
	c = temp
	count += 1
print(count)


(b, a) = map(int, input().split())
t = 0
s = [a, a, a]
while min(s) < b:
	x = min(s)
	if s[0] == x:
		s[0] = min(s[1] + s[2] - 1, b)
	elif s[1] == x:
		s[1] = min(s[0] + s[2] - 1, b)
	else:
		s[2] = min(s[0] + s[1] - 1, b)
	t += 1
print(t)


from math import sqrt
import sys
(x, y) = [int(i) for i in input().split()]
a = y
b = y
c = y
count = 0
while a != x or b != x or c != x:
	min_side = min(min(a, b), c)
	max_side = max(max(a, b), c)
	mid_side = a + b + c - max_side - min_side
	new_side = min(max_side + mid_side - 1, x)
	a = mid_side
	b = max_side
	c = new_side
	count += 1
print(count)


def devolution(a, b):
	(lst, result) = ([b] * 3, 0)
	while lst != [a] * 3:
		lst.sort()
		lst[0] = min(lst[1] + lst[2] - 1, a)
		result += 1
	return result
(x, y) = [int(i) for i in input().split()]
print(devolution(x, y))


import sys
(a, b) = map(int, sys.stdin.readline().split())
la = [min(a, 2 * b - 1), b, b]
cnt = 1
while 1 < 2:
	la[la.index(min(la))] = min(sum(la) - min(la) - 1, a)
	cnt += 1
	if la == [2 * b - 1, a, a]:
		cnt += 1
		break
	elif la == [a, a, a]:
		break
print(cnt)


(x, y) = map(int, input().split())
(a, v) = ([y] * 3, 0)
while a[0] < x:
	a[0] = min(x, a[1] + a[2] - 1)
	a.sort()
	v += 1
print(v)


(y, x) = list(map(int, input().split()))
a = x
b = x
c = x
k = 0
while a < y or b < y or c < y:
	if a < c + b - 1:
		a = c + b - 1
		k += 1
		if a >= y and b >= y and (c >= y):
			break
	if b < a + c - 1:
		b = a + c - 1
		k += 1
		if a >= y and b >= y and (c >= y):
			break
	if c < a + b - 1:
		c = a + b - 1
		k += 1
		if a >= y and b >= y and (c >= y):
			break
print(k)


def exists(a, b, c):
	return a < b + c and b < a + c and (c < a + b)
(x, y) = [int(i) for i in input().split()]
(a, b, c) = (y, y, y)
count = 0
while a != x or b != x or c != x:
	(a, b, c) = sorted([a, b, c])
	a = x if exists(x, b, c) else b + c - 1
	count += 1
print(count)


(x, y) = map(int, input().split())
(a, b, c) = (y, y, y)
cnt = 0
while True:
	if a >= x and b >= x and (c >= x):
		break
	cnt += 1
	if cnt % 3 == 0:
		a = b + c - 1
	elif cnt % 3 == 1:
		b = c + a - 1
	elif cnt % 3 == 2:
		c = b + a - 1
print(cnt)


(x, y) = map(int, input().split())
l = [y, y, y]

def arg():
	argmax = 0
	argmin = 0
	for i in range(1, 3):
		if l[i] > l[argmax]:
			argmax = i
		if l[i] < l[argmin]:
			argmin = i
	if argmax == argmin:
		argmax = 0
		argmin = 1
	tmp = [0, 1, 2]
	tmp.remove(argmax)
	tmp.remove(argmin)
	return (argmin, tmp[0], argmax)
cnt = 0
while l[0] != x or l[1] != x or l[2] != x:
	args = arg()
	l[args[0]] = min(x, l[args[2]] + l[args[1]] - 1)
	cnt += 1
print(cnt)


from sys import stdin
(n, m) = map(int, stdin.readline().strip().split())
x = [m, m, m]
ans = 0
while not (x[0] >= n and x[1] >= n and (x[2] >= n)):
	ans += 1
	x.sort()
	y = x[1] + x[2] - 1
	x[0] = y
print(ans)


from __future__ import division, print_function
import itertools
import sys
import os
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip

def is_it_local():
	script_dir = str(os.getcwd()).split('/')
	username = 'dipta007'
	return username in script_dir

def READ(fileName):
	if is_it_local():
		sys.stdin = open(f'./{fileName}', 'r')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if not is_it_local():
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')

def input1(type=int):
	return type(input())

def input2(type=int):
	[a, b] = list(map(type, input().split()))
	return (a, b)

def input3(type=int):
	[a, b, c] = list(map(type, input().split()))
	return (a, b, c)

def input_array(type=int):
	return list(map(type, input().split()))

def input_string():
	s = input()
	return list(s)

def main():
	(x, y) = input2()
	if x > y:
		(x, y) = (y, x)
	arr = [x, x, x]
	cnt = 0
	while arr[0] != y:
		rem = arr[1] + arr[2]
		k = min(y, rem - 1)
		arr[0] = k
		arr.sort()
		cnt += 1
	print(cnt)
	pass
main()


(x, y) = map(int, input().split())
cur = (y, y, y)
cnt = 0
while cur < (x, x, x):
	new = cur[1] + cur[2] - 1
	cur = (cur[1], cur[2], new)
	cnt += 1
print(cnt)


(a, b) = input().split()
x = int(a)
y = int(b)
x_v = [y, y, y]
result = 0
while x_v[0] != x or x != x_v[1] or x != x_v[2]:
	x_v.sort()
	x_v[0] = min(x, x_v[1] + x_v[2] - 1)
	result += 1
print(result)


s = input().split()
a = int(s[0])
b = int(s[1])
count = 0
g = 0
C = list(range(3))
C[0] = b
C[1] = b
C[2] = b
while C[0] != a or C[1] != a or C[2] != a:
	if C[1] + C[2] > a:
		C[0] = a
		count += 1
		g = C[2]
		C[2] = C[1]
		C[1] = C[0]
		C[0] = g
	else:
		C[0] = C[1] + C[2] - 1
		count += 1
		g = C[2]
		C[2] = C[1]
		C[1] = C[0]
		C[0] = g
print(count)


(x, y) = map(int, input().split())
cur = [y, y, y]
count = 0
while cur[0] < x:
	cur[0] = cur[1] + cur[2] - 1
	cur.sort()
	count += 1
print(count)


(x, y) = map(int, input().split())
arr = [y, y, y]
c = 0
t = 0
while True:
	if arr.count(x) == 3:
		break
	if t == 0:
		arr[0] = arr[1] + arr[2] - 1
		if arr[0] > x:
			arr[0] = x
		t = 1
	elif t == 1:
		arr[1] = arr[0] + arr[2] - 1
		if arr[1] > x:
			arr[1] = x
		t = 2
	elif t == 2:
		arr[2] = arr[0] + arr[1] - 1
		if arr[2] > x:
			arr[2] = x
		t = 0
	c += 1
print(c)


(initial, final) = map(int, input().split())
arr = [final] * 3
ans = 0
while sum(arr) < 3 * initial:
	arr.sort()
	arr[0] = min(initial, arr[1] + arr[2] - 1)
	ans += 1
print(ans)


(x, y) = list(map(int, input().split()))
assert y < x
it = 0
(a, b, c) = (y, y, y)
while True:
	assert a >= c >= b
	assert a + b > c
	assert a + c > b
	assert b + c > a
	b = a + c - 1
	assert a + b > c
	assert a + c > b
	assert b + c > a
	it += 1
	if b >= x:
		b = x
		break
	(a, b, c) = (b, c, a)
b = x
it += 1
assert a + b > c
assert a + c > b
assert b + c > a
c = x
it += 1
assert a + b > c
assert a + c > b
assert b + c > a
print(it)


import math
(x, y) = map(int, input().split())
res = 0
now = [y, y, y]
while min(now) < x:
	res += 1
	ind = now.index(min(now))
	(o1, o2) = ((ind + 1) % 3, (ind + 2) % 3)
	now[ind] = now[o1] + now[o2] - 1
print(res)


from math import *

def solve(a, b):
	if a[0] == b:
		return 0
	else:
		return solve([a[1], a[2], min(b, a[1] + a[2] - 1)], b) + 1
(a, b) = (int(z) for z in input().split())
if a > b:
	(a, b) = (b, a)
print(solve([a, a, a], b))


(x, y) = map(int, input().split())
(a, b, c) = (y, y, y)
turn = 0
while True:
	if a >= x and b >= x and (c >= x):
		print(turn)
		break
	if turn % 3 == 0:
		a = b + c - 1
	elif turn % 3 == 1:
		b = c + a - 1
	else:
		c = a + b - 1
	turn += 1


(x, y) = list(map(int, input().split()))
ar = [y, y, y]
i = 0
while ar[0] < x or ar[1] < x or ar[2] < x:
	if ar[0] >= ar[1] <= ar[2]:
		ar[1] = ar[0] + ar[2] - 1
	elif ar[0] >= ar[2] <= ar[1]:
		ar[2] = ar[0] + ar[1] - 1
	elif ar[1] >= ar[0] <= ar[2]:
		ar[0] = ar[1] + ar[2] - 1
	i += 1
print(i)


(a, b) = map(int, input().split())
if a > b:
	(a, b) = (b, a)
l = [a, a, a]
ans = 0
while True:
	if sum(l) == 3 * b:
		break
	for i in range(3):
		if l[i] < b:
			temp = sum(l) - l[i]
			l[i] = min(b, temp - 1)
			ans += 1
		if sum(l) == 3 * b:
			break
	if sum(l) == 3 * b:
		break
print(ans)


(x, y) = list(map(int, input().split()))
(x, y) = (min(x, y), max(x, y))
(a, b, c) = (x, x, x)
ans = 0
while not a == b == c == y:
	a = min(b + c - 1, y)
	ans += 1
	if not a == b == c == y:
		b = min(a + c - 1, y)
		ans += 1
		if not a == b == c == y:
			c = min(a + b - 1, y)
			ans += 1
		else:
			break
	else:
		break
print(ans)


(n, m) = map(int, input().split())
s = [m, m, m]
ans = 0
while s[0] < n:
	temp = min(n, s[1] + s[2] - 1)
	s[0] = s[1]
	s[1] = s[2]
	s[2] = temp
	ans += 1
print(ans)


s = input().split()
tr = int(s[0])
gl = int(s[1])
list = list(range(3))
list[0] = gl
list[1] = gl
list[2] = gl
b = 0
while list[0] != tr or list[1] != tr or list[2] != tr:
	if list[1] + list[2] - 1 > tr:
		if list[0] != tr:
			list[0] = tr
			b += 1
	elif list[0] != tr:
		list[0] = list[1] + list[2] - 1
		b += 1
	if list[0] + list[2] - 1 > tr:
		if list[1] != tr:
			list[1] = tr
			b += 1
	elif list[1] != tr:
		list[1] = list[0] + list[2] - 1
		b += 1
	if list[0] + list[1] - 1 > tr:
		if list[2] != tr:
			list[2] = tr
			b += 1
	elif list[2] != tr:
		list[2] = list[0] + list[1] - 1
		b += 1
print(b)


(s, t) = map(int, input().split())
s = [s, s, s]
t = [t, t, t]
it = 0
i = 0
while s[i] != t[i]:
	t[i] = min(s[i], t[(i + 1) % 3] + t[(i + 2) % 3] - 1)
	it += 1
	i = (i + 1) % 3
print(it)


line1 = input().split()
x = int(line1[0])
y = int(line1[1])
(a, b, c) = (y, y, y)
steps = 0
while a < x or b < x or c < x:
	a = b + c - 1
	steps += 1
	(a, b, c) = (min(a, b, c), a + b + c - max(a, b, c) - min(a, b, c), max(a, b, c))
print(steps)


c = 0
d = 0
t = input().split()
x = int(t[0])
y = int(t[1])
xx = [y, y, y]
yy = [x, x, x]
while yy != xx:
	xx.sort()
	z = sum(xx[1:3]) - 1
	c = c + 1
	if z >= x:
		xx[0] = x
	else:
		xx[0] = z
print(c)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(x, y) = map(int, input().split())
a = y
b = y
c = y
t = 1
ans = 0
while True:
	if a == x and b == x and (c == x):
		break
	ans += 1
	if t == 1:
		a = b + c - 1
		if a > x:
			a = x
	elif t == 2:
		b = a + c - 1
		if b > x:
			b = x
	else:
		c = b + a - 1
		if c > x:
			c = x
	t = (t + 1) % 3
print(ans)


(x, y) = [int(x) for x in input().split(' ')]
triset = [y] * 3
c = 0
while sum(triset) < x * 3:
	triset.sort()
	triset[0] = triset[2] + triset[1] - 1
	if triset[0] > x:
		triset[0] = x
	c += 1
print(c)


(x, y) = map(int, input().split())
(a, b, c) = (y, y, y)
k = 0
while a != x:
	(a, b, c) = sorted([min(x, b + c - 1), b, c])
	k += 1
print(k)


(g, a) = [int(x) for x in input().split()]
b = c = a
s = 0
while min(min(a, b), c) < g:
	s += 1
	l = [a, b, c]
	l.sort()
	(a, b, c) = l
	a = min(g, c + b - 1)
print(s)


(x, y) = list(map(int, input().split()))
a = [y, y, y]
c = 0
while 1 > 0:
	if x <= a[0] + a[1] - 1:
		print(c + 3)
		break
	else:
		a[-1] = a[0] + a[1] - 1
		c += 1
		a.sort(reverse=True)


(x, y) = [int(i) for i in input().split()]
if x > y:
	t = x
	x = y
	y = t
a = [x, x, x]
ans = 0
while a[0] != y or a[1] != y or a[2] != y:
	a[0] = min(a[1] + a[2] - 1, y)
	a.sort()
	ans += 1
print(ans)


[x, y] = [int(x) for x in input().split()]
(a, b, c) = (y, y, y)
res = 0
while a != x or b != x or c != x:
	res += 1
	minimum = min(a, b, c)
	if a == minimum:
		a = min(b + c - 1, x)
	elif b == minimum:
		b = min(a + c - 1, x)
	else:
		c = min(a + b - 1, x)
print(res)


(n, m) = map(int, input().split())
ans = 0
t = [m] * 3
while t != [n] * 3:
	t = t[1:] + [min(t[1] + t[2] - 1, n)]
	ans += 1
print(ans)


(x, y) = map(int, input().split())
if x // 2 < y:
	print(3)
else:
	lis = [y] * 3
	c = 0
	while max(lis) < x:
		a = lis[1] + lis[2]
		lis.sort()
		lis[0] = a - 1
		lis.sort()
		c += 1
	print(c + 2)


x = input().split()
(x[0], x[1]) = (int(x[0]), int(x[1]))
y = [x[1]] * 3
c = 0
while y[2] < x[0]:
	(y[0], y[1], y[2]) = (y[1], y[2], y[1] + y[2] - 1)
	c += 1
c += 2
print(c)


(x, y) = map(int, input().split())
besta = y
bestb = y
bestc = y
time = 0
while True:
	if besta >= x and bestb >= x and (bestc >= x):
		print(time)
		break
	time += 1
	if time % 3 == 1:
		besta = bestb + bestc - 1
	elif time % 3 == 2:
		bestb = besta + bestc - 1
	elif time % 3 == 0:
		bestc = besta + bestb - 1


(x, y) = map(int, input().split())
a = b = c = y
ans = 0
while min(a, b, c) != x:
	arr = list(sorted([a, b, c]))
	arr[0] = min(x, arr[1] + arr[2] - 1)
	(a, b, c) = arr
	ans += 1
print(ans)


(x, y) = map(int, input().split())
counter = 0
(x, y) = (min(x, y), max(x, y))
x1 = x
x2 = x
x3 = x
while y > x1 or y > x2 or y > x3:
	if x1 != y:
		x1 = min(x3 + x2 - 1, y)
		counter += 1
	if x2 != y:
		x2 = min(x1 + x3 - 1, y)
		counter += 1
	if x3 != y:
		x3 = min(x1 + x2 - 1, y)
		counter += 1
print(counter)


def triangle(a, y, prt=False):
	if min(a) >= y:
		return 0
	elif a[1] + a[2] - 1 >= y:
		return triangle([a[1], a[2], y], y) + 1
	else:
		return triangle([a[1], a[2], a[1] + a[2] - 1], y) + 1

def main():
	(x, y) = list(map(int, input().split(' ')))
	print(triangle([y, y, y], x))
main()


def main():
	(x, y) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	a = b = c = x
	res = 0
	while a < y:
		(a, b, c) = (b, c, b + c - 1)
		res += 1
	print(res)
main()


(a, b) = map(int, input().split())
l1 = [a, a, a]
l2 = [b, b, b]
ct = 0
if a == b:
	print(0)
else:
	while max(l2) != a:
		l2.remove(min(l2))
		s = sum(l2)
		d = abs(l2[0] - l2[1])
		if d < a < s:
			l2.append(a)
		else:
			l2.append(s - 1)
		ct += 1
	print(ct + 2)


def solve(x, y):
	A = [y] * 3
	k = 0
	while A[0] != x:
		k += 1
		A[0] = min(A[1] + A[2] - 1, x)
		A.sort()
	return k
(x, y) = map(int, input().split())
print(solve(x, y))


(x, a) = map(int, input().split())
b = c = a
res = 0
while a < x:
	(a, b, c) = (b, c, b + c - 1)
	res += 1
print(res)


(x, y) = map(int, input().split())
(a, b, c) = (y, y, y)
ans = 0
while a < x:
	(a, b, c) = (b, c, b + c - 1)
	ans += 1
print(ans)


(x, y) = map(int, input().split())
a = [y, y, y]
cnt = 0
while True:
	if a[0] == a[1] == a[2] == x:
		break
	if a[1] + a[2] > x:
		a[0] = x
	else:
		a[0] = a[1] + a[2] - 1
	cnt += 1
	a.sort()
print(cnt)


(x, y) = map(int, input().split())
(a, b, c) = (y, y, y)
steps = 0
while a < x:
	(a, b, c) = (b, c, min(x, b + c - 1))
	steps += 1
print(steps)


(x, y) = map(int, input().split())
temp = [y] * 3
k = y
cnt = 0
while k != x:
	temp.sort()
	temp[0] = min(temp[1] + temp[2] - 1, x)
	k = min(temp)
	cnt += 1
print(cnt)


import sys

def read_data():
	return list(map(int, next(sys.stdin).split()))

def solve(f, t):
	if f > t:
		(f, t) = (t, f)
	if f == t:
		return 0
	(a, b, c) = (f, f, f)
	count = 0
	while a < t:
		c = min(a + b - 1, t)
		(c, b, a) = sorted((a, b, c))
		count += 1
	if b < t:
		count += 1
		if c < t:
			count += 1
	return count

def __starting_point():
	(f, t) = read_data()
	print(solve(f, t))
__starting_point()


read = input()
read = read.split(' ')
a = [0] * 4
n = int(read[0])
m = int(read[1])
a[1] = m
a[2] = m
a[3] = m

def mysort():
	for i in range(1, 4):
		for j in range(i, 4):
			if a[i] > a[j]:
				(a[i], a[j]) = (a[j], a[i])
	return

def getans():
	t = 0
	if n == m:
		return 0
	while 0 == 0:
		mysort()
		t = t + 1
		if a[2] + a[3] - 1 <= n:
			a[1] = a[2] + a[3] - 1
		else:
			a[1] = n
		if a[1] == n and a[2] == n and (a[3] == n):
			return t
	return 0
print(getans())


(y, x) = map(int, input().split())
arr = [x, x, x]
count = 0
while True:
	if arr[0] >= y:
		break
	count += 1
	arr[0] = min(y, arr[1] + arr[2] - 1)
	arr.sort()
print(count)


(n, m) = map(int, input().split())
(a, b, c) = (m, m, m)
cou = 0
if n == m:
	print(0)
	exit()
while True:
	if a < b:
		if a < c:
			a = min(b + c - 1, n)
		else:
			c = min(a + b - 1, n)
	elif b < c:
		b = min(a + c - 1, n)
	else:
		c = min(a + b - 1, n)
	cou += 1
	if a == n and b == n and (c == n):
		break
print(cou)


import bisect
from collections import defaultdict
import os
import sys
from io import BytesIO, IOBase
ii = lambda : int(input())
lmii = lambda : list(map(int, input().split()))
slmii = lambda : sorted(map(int, input().split()))
li = lambda : list(input())
mii = lambda : map(int, input().split())
msi = lambda : map(str, input().split())

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def main():
	(x, y) = mii()
	cnt = 0
	(a, b, c) = (y, y, y)
	while max(a, b, c) < x:
		ss = sorted([a, b, c])
		a = ss[0]
		b = ss[1]
		c = ss[2]
		a = min(x, b + c - 1)
		cnt += 1
	print(cnt + 2)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


lst = list(map(int, input().split()))
y = lst[1]
x = lst[0]
res = 0
(ba, bc, bd) = (y, y, y)
while True:
	if ba >= x and bb >= x and (bc >= x):
		print(res)
		break
	res += 1
	if res % 3 == 0:
		ba = bb + bc - 1
	if res % 3 == 1:
		bb = ba + bc - 1
	if res % 3 == 2:
		bc = bb + ba - 1


(s, e) = map(int, input().split())
a = [e] * 3
ans = 0
sum = 0
while sum != 2:
	temp = a[1] + a[2]
	if temp - 1 >= s:
		a[0] = s
		sum += 1
	else:
		a[0] = temp - 1
	a.sort()
	ans += 1
print(ans + 1)


(x, y) = map(int, input().split())
s = [y, y, y]
k = 0
while sum(s) != x * 3:
	mi = min(s)
	ma = max(s)
	sr = sum(s) - ma - mi
	a = sum([sr, ma]) - 1
	if a > x:
		a = x
	s[s.index(mi)] = a
	k += 1
print(k)


(x, y) = list(map(int, input().split()))
a = [y] * 3
ans = 0
while 1:
	if a[0] == x and a[1] == x and (a[2] == x):
		break
	a[0] = min(x, a[1] + a[2] - 1)
	a.sort()
	ans += 1
print(ans)


(x, y) = map(int, input().split())
ans = 0
a = b = c = y
while not (a >= x and b >= x and (c >= x)):
	if ans % 3 == 0:
		a = b + c - 1
	elif ans % 3 == 1:
		b = a + c - 1
	else:
		c = a + b - 1
	ans += 1
print(ans)


(y, x) = map(int, input().split())

def f(a):
	a = sorted(a)
	if a[0] == y:
		return 0
	a[0] = min(sum(a[1:]) - 1, y)
	return 1 + f(a)
print(f([x, x, x]))


(x, y) = [int(x) for x in input().split()]
(a, b, c) = (y, y, y)
ans = 0
while a < x and b < x and (c < x):
	mini = min(a, b, c)
	if mini == a:
		a = b + c - 1
	elif mini == b:
		b = a + c - 1
	else:
		c = a + b - 1
	ans += 1
print(ans + 2)


(x, y) = map(int, input().split())
ar = [y, y, y]
ans = 0
while min(ar) < x:
	ar.sort()
	ar[0] = ar[1] + ar[2] - 1
	ans += 1
print(ans)


(x, y) = map(int, input().split())
ans = 1
sides = [y] * 3
while sides[-1] < x:
	ans += 1
	sides[2] = min(sides[0] + sides[1] - 1, x)
	sides = sorted(sides, reverse=True)
print(ans - 1)


import sys
fin = sys.stdin
while True:
	s = fin.readline().strip()
	if s == '':
		break
	(x, y) = [int(x) for x in s.split()]
	(a, b, c) = (y, y, y)
	time = 0
	while a < x:
		time += 1
		(a, b, c) = (b, c, b + c - 1)
	print(time)


def increase_triangle_side(first_side, second_side, third_side, count_increas_times, ending_length):
	count_increas_times += 1
	if first_side > second_side:
		(first_side, second_side) = (second_side, first_side)
	if first_side > third_side:
		(first_side, third_side) = (third_side, first_side)
	first_side = second_side + third_side - 1
	if first_side > ending_length and second_side > ending_length and (third_side > ending_length):
		return count_increas_times
	else:
		return increase_triangle_side(first_side, second_side, third_side, count_increas_times, ending_length)

def counting_changing_times():
	(x, y) = map(int, input().split())
	changing_times = increase_triangle_side(y, y, y, 0, x)
	print(changing_times)
counting_changing_times()


(n, k) = map(int, input().split())
x = k
y = k
z = k
turns = 0
while True:
	if x >= n and y >= n and (z >= n):
		print(turns)
		break
	turns += 1
	if turns % 3 == 1:
		x = y + z - 1
	if turns % 3 == 2:
		y = z + x - 1
	if turns % 3 == 0:
		z = x + y - 1


from __future__ import print_function
from collections import *
from sys import stdin
from heapq import *
from math import *
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
rr = lambda x: reversed(range(x))
mod = int(1000000000.0) + 7
inf = float('inf')
l = gil()
l.sort()
t = [l[0]] * 3
ans = 0
while t[0] != l[1]:
	t[0] = min(l[1], sum(t[1:]) - 1)
	t.sort()
	ans += 1
print(ans)


(x, y) = (int(i) for i in input().split())
(a, b, c) = (y, y, y)
ans = 0
while a < x:
	(a, b, c) = sorted((min(x, b + c - 1), b, c))
	ans += 1
print(ans)


(x, y) = input().split()
x = int(x)
y = int(y)
a = y
b = y
c = y
z = 1
ans = 0
while True:
	if z == 1:
		a = b + c - 1
		z += 1
		ans += 1
		if a >= x:
			break
	elif z == 2:
		b = c + a - 1
		z += 1
		ans += 1
		if b >= x:
			break
	else:
		c = a + b - 1
		z = 1
		ans += 1
		if c >= x:
			break
print(ans + 2)


(a, b) = map(int, input().split())
l = [b, b, b]
k = 0
while l[0] != a or l[1] != a or l[2] != a:
	l[0] = min(a, l[2] + l[1] - 1)
	l = sorted(l)
	k += 1
print(k)


def solve(n, m):
	a = [m, m, m]
	c = 0
	while a[-1] + a[-2] - 1 < n:
		a[0] = a[-1] + a[-2] - 1
		c += 1
		a.sort()
	return c + 3
(n, m) = map(int, input().split())
print(solve(n, m))


(x, y) = map(int, input().split(' '))
ans = 0
A = [y] * 3
while sum(A) < x * 3:
	A.sort()
	A[0] = min(x, A[1] + A[2] - 1)
	ans += 1
print(ans)


(a, b) = input().strip().split(' ')
(a, b) = (int(a), int(b))
l = [b, b, b]
ans = 0
while l != [a, a, a]:
	l.sort()
	l[0] = min(l[1] + l[2] - 1, a)
	ans += 1
print(ans)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(r, l) = I()
a = [l, l, l]
ans = 0
while a[-1] != r or a[0] != r:
	x = a[1] + a[2]
	a[0] = min(r, x - 1)
	a.sort()
	ans += 1
print(ans)


s = input()
x = int(s.split()[0])
y = int(s.split()[1])
a = [0] * 25
a[0] = y
a[1] = 2 * y - 1
ans = 0
for i in range(2, 25):
	if x <= a[i - 1]:
		ans = i + 1
		break
	a[i] = a[i - 1] + a[i - 2] - 1
print(ans)


(x, y) = map(int, input().split())
(arr, res) = ([y, y, y], 0)
while arr[0] < x:
	res += 1
	arr[0] = min(arr[1] + arr[2] - 1, x)
	arr.sort()
print(res)


(x, y) = map(int, input().split())
per = 0 if x != y else 3
ans = 0
per1 = y
per2 = y
per3 = y
while per < 3:
	if per1 <= per2 and per1 <= per3:
		if per3 + per2 - 1 >= x:
			per += 1
			per1 = x
		else:
			per1 = per3 + per2 - 1
	elif per2 <= per1 and per2 <= per3:
		if per3 + per1 - 1 >= x:
			per += 1
			per2 = x
		else:
			per2 = per3 + per1 - 1
	elif per3 <= per2 and per3 <= per1:
		if per1 + per2 - 1 >= x:
			per += 1
			per3 = x
		else:
			per3 = per1 + per2 - 1
	ans += 1
print(ans)


(x, y) = input().split()
x = int(x)
y = int(y)
a = [y, y, y]
count = 0
r = 2
while True:
	a[r] = a[r - 1] + a[r - 2] - 1
	count += 1
	if min(a) >= x:
		break
	r = (r + 1) % 3
print(count)


(x, y) = [int(x) for x in input().split()]
a = [y, y, y]
c = 0
while True:
	a.sort()
	if a[2] + a[1] > x:
		break
	a[0] = a[1] + a[2] - 1
	c += 1
print(c + 3)