Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be n players participating, and the tournament will follow knockout rules from the very first game. That means, that if someone loses a game he leaves the tournament immediately.Organizers are still arranging tournament grid (i.e. the order games will happen and who is going to play with whom) but they have already fixed one rule: two players can play against each other only if the number of games one of them has already played differs by no more than one from the number of games the other one has already played. Of course, both players had to win all their games in order to continue participating in the tournament.Tournament hasn't started yet so the audience is a bit bored. Ostap decided to find out what is the maximum number of games the winner of the tournament can take part in (assuming the rule above is used). However, it is unlikely he can deal with this problem without your help.

The only line of the input contains a single integer n (2 ≤ n ≤ 1018) — the number of players to participate in the tournament.

Print the maximum number of games in which the winner of the tournament can take part.

NoteIn all samples we consider that player number 1 is the winner.In the first sample, there would be only one game so the answer is 1.In the second sample, player 1 can consequently beat players 2 and 3. In the third sample, player 1 can't play with each other player as after he plays with players 2 and 3 he can't play against player 4, as he has 0 games played, while player 1 already played 2. Thus, the answer is 2 and to achieve we make pairs (1, 2) and (3, 4) and then clash the winners.

from sys import stdout
n = int(input())
dp = [0 for i in range(100)]
dp[0] = 1
dp[1] = 2

for i in range(2, n + 10):
    if dp[i - 1] > n:
        stdout.write(str(i - 2))
        break
    dp[i] = dp[i - 1] + dp[i - 2]

n = int(input())

ans = 0
a = 1
b = 2
while b <= n:
    c = a + b
    a = b
    b = c
    ans += 1

print(ans)

n = int(raw_input())
k = 1
a = 2; b = 1
while a + b <= n: a, b = a + b, a; k += 1
print k

from collections import defaultdict
from fractions import gcd
from bisect import *
import sys
sys.setrecursionlimit(5*10**6)
def sint():
    return int(raw_input())
def sarr():
    return [int(x) for x in raw_input().split()]
def sstr():
    return raw_input()

f=[0]*300
f[0]=1
f[1]=1
for i in range(2,300):
    f[i]=f[i-1]+f[i-2]
#print f[299]

n=sint()
print bisect_right(f,n)-2

import math
a = int(raw_input())
fib = [1,2]
for i in xrange(86):
	fib.append(fib[-1]+fib[-2])
start = 1
while True:
	if fib[start] > a:
		print start-1
		break
	if fib[start] == a:
		print start
		break
	start +=1

import math
def main():
    n = int(input())
    phib = [1, 1]
    ans = 0
    while(phib[-1] + phib[-2] <= n):
        phib.append(phib[-1] + phib[-2])
        ans += 1

    print(ans)
main()

n = int(input())
x = [1,2]
while x[-1] < n:
    x.append(x[-1]+x[-2])
if x[-1] == n:
    print(len(x)-1)
else:
    print(len(x)-2)

n = int(input())
a, b = int(1), int(2)
ans = int(0)
while b <= n:
    a, b = b, b + a
    ans += 1
print(ans)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
def fibo(n):
	f0=0
	f1=1
	if (n==0):
		fibo=0
	elif n==1:
		fibo=1
	else:
		for i in range(1,n):
			fibo=f0+f1
			f0=f1
			f1=fibo
	return(fibo)

n=int(input())
ans=0
for k in range(n+5):
	if (fibo(k) > n):
		ans=k-3
		break
	else:
		pass
print(ans)

n=int(input())
a,b=2,1
c=0
while a<=n:
    a,b=a+b,a
    c+=1
print(c)

n = int(raw_input(""))
a=2
b=1
c=0
i=1
while(a+b<=n):
	c=a+b
	b=a
	a=c
	i=i+1
print(i)

import math
def inp():
    return int(raw_input())
def linp():
    return map(int, raw_input().split())
n = inp()
prev = 1
curr = 2
ans = 0
while curr<=n:
    temp = curr
    curr = prev+curr
    prev = temp
    ans+=1
print ans

a = int(input())
fib=[1,2]
for i in range(100):
    fib.append(fib[-1]+fib[-2])

for i in range(1, 1000):
    if fib[i]<=a<fib[i+1]:
        print(i)
        quit()

num = long(raw_input())
fibo = [0, 1]
while fibo[-1] < num:
    fibo.append(fibo[-1] + fibo[-2])
res = len(fibo) - 3
if num < fibo[-1]:
    res -= 1
print res

n = int(input())
dp = [1, 2]
while dp[-2] + dp[-1] <= n:
    dp.append(dp[-2] + dp[-1])
print(len(dp) - 1)

# Returns the minimum number of players that need to be in the tournament for the champion to play at least `x` games
def players_for_champ_level(x, cache={}):
    if x == 1:
        return 2
    elif x == 2:
        return 3
    elif x in cache:
        return cache[x]
    else:
        # For the champion to get to the level `x` (play `x` games) he needs to be level `x` - 1 and there needs to be
        # another player of level `x` - 2
        x_result = players_for_champ_level(x - 1, cache) + players_for_champ_level(x - 2, cache)

        cache[x] = x_result

        return x_result

x = int(raw_input())

champ_level = 0

while players_for_champ_level(champ_level + 1) <= x:
    champ_level += 1

print champ_level

def solve(n):
    k = 0
    f1, f2 = 1, 2
    while not f1 <= n < f2:
        k += 1
        t = f1
        f1 = f2
        f2 = f1 + t
    return k

n = int(input())
print(solve(n))

n=int(input())
i=2
x=2
y=3
s=0
if(n<4):
    if n==2:
        print(1)
    else:
        print(2)
else:
    while(1):
        s=y+x
        if s>n:
            break
        i+=1
        x=y
        y=s
    print(i)

from itertools import *
from bisect import *

def fibonacci_generator():
	a,b = 2,1
	for _ in count():
		a,b = a+b,a
		yield b

fibs = list(islice(fibonacci_generator(), 0, 100))
f = lambda x: bisect(fibs,x)
print f(int(raw_input()))

n=int(input())

x,y=1,1
z=-1

for i in range(0,n+1):
    if y>n:
        print(i-1)
        break

    z=x+y
    x=y
    y=z

from math import *

def main():
    n=int(input())
    prev,fib=1,2
    count=0
    while fib<=n:
        prev,fib=fib,prev+fib
        count+=1
    print(count)

main()

n = int(input())

a,b,res = 2,1,0

while a <= n:
	a,b,res = a+b,a,res+1

print(res)

n = int(input())
a,b = 2,3
c   =   0
while n >= a:
   a,b = b,a+b
   c+=1
print(c)

fib = [0,1]
for i in range(2,100):
    fib.append(fib[i-1] + fib[i-2])
fib = fib[2:]
n = int(input())
maks = 0
for i in range(len(fib)):
    if n >= fib[i]:
        maks = max(maks,i)
    else:
        break

print(maks)

n = int(input())
b = 2
a = 1
d = 0
while b <= n:
    a, b = b, a + b
    d += 1
print(d)

from sys import stdin
n = int(stdin.readline())
fib = [0,2,3]
for i in xrange(110):
 fib.append(fib[-1] + fib[-2])
ans = 0
for i in xrange(110):
 if fib[i] > n:
  break
print i-1

n = int(input())
i1=1
i2=2
sol=0
while i2 <= n:
    aux = i1+i2
    i1 = i2
    i2 = aux
    sol = sol+1
print(sol)

n = int(input())

if n <= 2:
    print(n - 1)
    exit()

fib = [0, 1]
while fib[-1] <= n:
    fib.append(fib[-1] + fib[-2])

print(len(fib) - 4)

n=int(input())
if(n==2):
    print(1)
elif(n==3):
    print(2)

else:
    a=2
    b=3
    res=2;
    while(True):
        res+=1
        c=a+b
        if(c>n):
            break
        a=b
        b=c

    print(res-1)

from sys import stdout, stdin
from io import IOBase, BytesIO
from os import read, write, fstat
from math import sqrt

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 = read(self._fd, max(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, size: int = ...):
        while self.newlines == 0:
            b = read(self._fd, max(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:
            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")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

stdin, stdout = IOWrapper(stdin), IOWrapper(stdout)
input = lambda: stdin.readline().rstrip("\r\n")

n,a,b,c=int(input()),2,1,0
while a<=n:a,b=a+b,a;c+=1
print(c)

n=int(input())

a,b=2,1

c=0

while a<=n:

    a,b=a+b,a

    c+=1

print(c)

# Made By Mostafa_Khaled

def fib():
    a,b=1,1
    while b<10**18:
        a,b=b,a+b
        yield b
a,ans,n=fib(),0,input()
for i in a:
    ans+=1
    if i >= n:
        print ans-(i>n)
        break

n = int(raw_input())
n1 = 1
n2 = 2
fib = 1
while n2 <= n:
	t = n1
	n1 = n2
	n2 = t + n2
	fib = fib+1
print fib-1

# http://codeforces.com/problemset/problem/735/C
def main():
    num = int(input())
    num1 = 1
    num2 = 2
    tmp = 0
    cont = 0
    while tmp <= num:
        tmp = num1 + num2
        num1 = num2
        num2 = tmp
        cont += 1
    print(cont)
main()

n = int(input())

l = []
l.append(0)
l.append(1)
l.append(2)

k = 2
m = 1

while k < n:
    k = k + l[m]
    m = m + 1
    l.append(k)

if k > n:
    m = m - 1

print(m)

n = int(input())

f = 2
g = 1
c = 0

while f <= n:
	f, g = f+g, f
	c += 1

print(c)

n = int(input())

if n == 2:
	print(1)
elif n == 3:
	print(2)
else:
	x = 2
	y = 3
	counter = 0
	while x+ y <= n:
		x, y = y, x+y
		counter += 1
	print(2+counter)

n = int(input())
ans = 0
a = b = 1
while a + b <= n:
    a, b = a + b, a
    ans += 1
print(ans)

n = input()
ans = 1
n1 = 1
n2 = 2

while n>=n2:
    n1,n2 = n2,n1+n2
    ans += 1

print ans-1

import bisect
n = int(input())
c = [1,2]
for i in range(100):
    c.append(c[-1]+c[-2])
if n in c:
    print(bisect.bisect_left(c,n))
else:
    print(bisect.bisect_left(c,n)-1)

n = int(input())
ans = 0
a,b,x = 1,1,2
while x <= n :
    x = a+b
    a,b = b,x
    ans+=1

print(ans-1)

n = int(raw_input())
a = 1
b = 1
i = 0
while n >= a:
    a, b = a+b, a
    i += 1
    # print a, b
print i - 1

import math

n = raw_input()
n = int(n)

fib = [0,1]
index = 1
num = 1

while num <= n:
	num = fib[index] + fib[index-1];
	fib.append(num)
	index += 1

#print int(math.ceil((math.log(n,2))))
#print fn(n)
print index - 3

n = int(input())

a, b = 1, 1
i = 0

while b <= n:
	a, b = b, a+b
	i+=1

print(i-1)

N = int(input())
dp = [1]
for x in range(1, 1000):
        dp.append(dp[x-1] + dp[max(0, x-2)])
        if dp[-1] > N:
                print(x-1)
                break

import sys
#import math
#from collections import deque

def main():

	if (len(sys.argv) > 1 and sys.argv[1] == "debug"):
		sys.stdin = open("xxx.in", "r")
		sys.stdout = open("xxx.out", "w")

	n = int(input())
	num = b = 1
	cnt = -1
	while (n >= num):
		cnt += 1
		x = num
		num += b
		b = x
		#print(str(cnt) + " : " + str(b) + " " + str(num))

	print (cnt)

main()

n = int(input())

ans = 0
a = 1
b = 2
while b <= n:
    c = a + b
    a = b
    b = c
    ans += 1

print(ans)

from bisect import bisect
N = 100
dp = [0 for _ in range(N)]
dp[1] = 1
dp[2] = 2
for i in range(3, N):
    dp[i] = dp[i - 1] + dp[i - 2] + 1
for i in range(N):
    dp[i] += 1

def get_ans(n):
    for i in range(99, -1, -1):
        if dp[i] <= n:
            return i

n = int(raw_input())
print get_ans(n)

n = int(input())
i1=1
i2=2
sol=0
while i2 <= n:
    aux = i1+i2
    i1 = i2
    i2 = aux
    sol = sol+1
print(sol)

#!/usr/bin/python2
# -*- coding: utf-8 -*-

import sys

def rl(proc=None):
    if proc is not None:
        return proc(sys.stdin.readline())
    else:
        return sys.stdin.readline().rstrip()

fib = [ 1, 2 ]
while fib[-1] <= 10 ** 18:
    fib.append(fib[-1] + fib[-2])

def get(k):
    return fib[k]

def main():
    n = rl(int)
    n -= 2
    h = 1
    while n > 0:
        n -= get(h-1)
        if n >= 0:
            h += 1
    print h

if __name__ == '__main__':
    main()

f={0:1,1:2}
n=input()
nn=2
while nn<1000:
    f[nn]=f[nn-1]+f[nn-2]
    nn+=1
for ff in f.keys():
    if f[ff]>n:
        print ff-1
        exit(0)
    elif f[ff]==n:
        print ff
        exit(0)

n, arr, i = int(input()), [2, 3], 1
if n == 2:
    print(1)
elif n == 3:
    print(2)
else:
    a, ans = arr[i] + arr[i - 1], 2
    while (a <= n):
        i += 1
        arr.append(a)
        a = arr[i] + arr[i - 1]
        ans+=1
    print(ans)

n = int(input())
a = 1
b = 2
s = 1
k = 0
while s <= n:
    s = a + b
    a = b
    b = s
    k += 1
print(k)

n = int(input())
dp = [1, 2]
while dp[-2] + dp[-1] <= n:
    dp.append(dp[-2] + dp[-1])
print(len(dp) - 1)

n = eval(input())
a, b, = 2, 1
ans = 0;
while a <= n:
    a, b = a + b, a
    ans += 1
print(ans)

f = [0, 1]

for i in range(200):
    f.append(f[-1] + f[-2])

n = int(input())

ans = 0
for i in range(200):
    if((f[i] <= n) and (n < f[i + 1])):
        ans = i - 2
        break

print(ans)

n=int(input())
a,b=2,1
ans=0
while a<=n:
    a,b=a+b,a
    ans+=1
print(ans)

n=int(input())

x,y=1,1
z=-1

for i in range(0,n+1):
    if y>n:
        print(i-1)
        break

    z=x+y
    x=y
    y=z

n = int(raw_input())
a = 1
b = 1
i = 0
while n >= a:
    a, b = a+b, a
    i += 1
    # print a, b
print i - 1

n = int(input())
ans = 1
f0 = 1
f1 = 2
while(f1 <= n):
    f1 += f0
    f0 = f1 - f0
    ans += 1
print(ans - 1)

n = int(input())
f1 = 1
f2 = 1
ans = -1
while f2 <= n:
    f1, f2 = f2, f1+f2
    ans += 1
print(ans)

n=int(input())
i=2
x=2
y=3
s=0
if(n<4):
    if n==2:
        print(1)
    else:
        print(2)
else:
    while(1):
        s=y+x
        if s>n:
            break
        i+=1
        x=y
        y=s
    print(i)

n=int(input())
fib=1
last=1
i=0
while True:
    i+=1
    fib=fib+last
    last=fib-last
    if fib>n:
        print(i-1)
        exit(0)

n = int(input())
ans = 0
a,b,x = 1,1,2
while x <= n :
    x = a+b
    a,b = b,x
    ans+=1

print(ans-1)

n = int(input())
i = 0
fib1 = 1
fib2 = 1
x = 2
while x <= n :
    x = fib2 + fib1
    fib1,fib2 = fib2,x
    i += 1
    #print('{} {} {} {}'.format(fib1,fib2,x,i))
print( (i-1) )

n = input()
ans = 0

a = 0
b = 1

while b <= n:
    a, b = b, a + b
    ans += 1

print ans - 2

n = int(input())

ans = 0
a = 1
b = 2
while b <= n:
    c = a + b
    a = b
    b = c
    ans += 1

print(ans)

n = int(input())
prefix = [1, 1, 2]
now = 0
for i in range(85):
    prefix.append(prefix[-1] + prefix[-2])
#print(prefix[:4])
while n >= prefix[now] + 1:
        n -= prefix[now]
        now += 1
print(now)

n=int(input())
a,b=2,1
c=0
while a<=n:
    a,b=a+b,a
    c+=1
print(c)

n = int(raw_input(""))
a=2
b=1
c=0
i=1
while(a+b<=n):
	c=a+b
	b=a
	a=c
	i=i+1
print(i)

a = [1,1,2]
for i in range(3,201):
	a.append(a[i-1]+a[i-2])
n = int(input())
ans = 1
i = 3
while n >= a[i]:
	i += 1
	ans += 1
print(ans)

__author__ = 'ilyakuchumov'

def main():
    fib_list = [1, 2]
    for i in range(100):
        fib_list.append(fib_list[-1] + fib_list[-2])

    n = int(input())

    cur_ans = 0
    cur_n = 1

    while cur_n < n:
        cur_n += fib_list[cur_ans]
        cur_ans += 1

    print(cur_ans)

main()

n, a, b, v = int(input()), 1, 1, -1
while b <= n:
    a, b, v = b, a + b, v + 1
print(v)

def go():
	n = input()
	games=0
	p1=1
	p2=2
	while games<n:
		games+=1
		p1,p2=p2,p1+p2
		if p2>n:
			return games

print go()

n = int( input() )

val = 1
turn = 0

while val < n:
	val *= 2
	turn += 1

print( turn )

import math
n=int(input())
if(n<=3):
    print(2)
else:
    l=[]
    q=[]
    a=0;
    b=1;
    ans=1;
    c=a+b
    n=n-2;
    while(c<=(n)):
        a=b;
        b=c;
        n=n-c;
        c=a+b;
        ans+=1
    print(ans)

import math

n = raw_input()
n = int(n)

print math.ceil((math.log(n,2)))

n, ans = int(input()), 0
while (n > 1):
    if n & 1:
        n = (n + 1) >> 1
    else:
        n >>= 1
    ans += 1
print(ans)

def process(n):
  a = [0]
  while len(a)<n:
    a.append(a[len(a)/2]+1)
    #print a
  return a[-1]

print process(int(raw_input()))

from math import ceil, log

n = int(input())
print(ceil(log(n, 2)))

#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys, math, random, operator
from string import ascii_lowercase, ascii_uppercase
from fractions import Fraction, gcd
#from decimal import Decimal, getcontext
from itertools import product, permutations, combinations
from Queue import Queue, PriorityQueue
from collections import deque, defaultdict, Counter
#getcontext().prec = 100

MOD = 10**9 + 7
INF = float("+inf")

if sys.subversion[0] == "PyPy":
    import io, atexit
    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))
    sys.stdin = io.BytesIO(sys.stdin.read())
    raw_input = lambda: sys.stdin.readline().rstrip()
pr = lambda *args: sys.stdout.write(" ".join(str(x) for x in args) + "\n")
epr = lambda *args: sys.stderr.write(" ".join(str(x) for x in args) + "\n")
die = lambda *args: pr(*args) ^ exit(0)

read_str = raw_input
read_strs = lambda: raw_input().split()
read_int = lambda: int(raw_input())
read_ints = lambda: map(int, raw_input().split())
read_float = lambda: float(raw_input())
read_floats = lambda: map(float, raw_input().split())

"---------------------------------------------------------------"

n = read_int()

cache = {2: 1, 3: 2, 4: 2}
def get(n):
    if n not in cache:
        cache[n] = 1 + max(get(n//2), get(n-n//2))
    return cache[n]

print get(n)

# l = 0
# while 1 << l < n:
#     l += 1
# print l

from math import *
n = int(input())
print(round(log(sqrt(5)*n)/log((1.0+sqrt(5))/2.0) -.45) - 2)

from math import ceil,floor
n = int(input())
ans = 0
while True:
	ans += 1
	n /= 2
	if n <= 1:
		break
print(ans)

n=int(input())
maxigr=0
while n>1:
    if n%2==0:
        maxigr+=1
        n//=2
    else:
        n=(n+1)//2
        maxigr+=1
print(maxigr)

from math import *
n=int(input())
if n==0:
    print(0)
    exit()
else:
    m=log2(n)
    k=int(m)
    if m==k:
        print(k)
    else:
        print(k+1)

import math
n = int(input())
c = 0
while n != 1:
    if n % 2 == 0:
        c += 1
    else:
        c += 2
    n//=2

print(c)

import math
n = int(raw_input())
def ans(n):
    if n==2:
        return 1
    else:
        return ans(math.ceil(1.0*n/2))+1
print ans(n)

from math import *
n = int(input())

print(round(log(sqrt(5)*n,(1.0+sqrt(5))/2.0) - .465)-2 )

from math import ceil,log
print(ceil(log(int(input()),2)))

from math import log, ceil

x = int(raw_input())

print int(ceil(log(x, 2)))

t=input()
n=int(t) + 1 - 1
r=0
c=1
while c<n:
    r+=1
    c*=2
print(r)

import math
a = int(raw_input())
x = math.log(a,2)
print int(math.ceil(x))

n = int(input())

def count(i):
    if i == 2:
        return 1
    return 1 + count(i//2 + i%2)

print(count(n))

n = int(input())

k = 2
m = 1

while k < n:
    k = k + k -1
    m = m + 1

if k > n:
    m = m - 1

print(m)

from sys import stdin, stdout

n = int(stdin.readline())
ans = 0
while n != 1:
    ans += 1
    n = n // 2 + n % 2

stdout.write(str(ans))

n = int(input())

if n == 2:
	print(1)
if n == 3:
	print(2)
x = 2
y = 3
counter = 0
while x+ y <= n:
	x, y = y, x+y
	counter += 1
print(2+counter)

n = int(raw_input())
a, b = 1, 1
c = 0
while a < n:
	a, b = b+a, a
	c += 1
print(c-1)

def process(n):
  a = [0]
  while len(a)<n:
    a.append(a[len(a)/2]+1)
    #print a
  return a[-1]

print process(int(raw_input()))

n = int(input())
ans = 0
if n >= 8:
	n *= 2
while n > 2 ** ans:
	ans += 1
print(ans)

n = int(input())
dp = {}
dp[1] = 1
dp[2] = 1

def calc(k):
    if k in dp:
        return dp[k]
    k1, k2 = k // 2, k - k // 2
    s1, s2 = calc(k1), calc(k2)
    if s1 < s2:
        s1, s2 = s2, s1
    if abs(s1 - s2) <= 1:
        return s1 + 1
    else:
        return s1

print(calc(n))

#!/usr/bin/env python
# -*- coding: utf-8 -*-

n=int(input())
lin=[i for i in range(1,n+1)]
tk=0
for k in lin:
	print(tk,'k',k)
	if (tk+k) > n:
		print(k-1)
		break
	else:
		tk+=k

import math

n = raw_input()
n = int(n)

print int(math.ceil((math.log(n,2))))

from math import *
n = int(input())
print(round(log(sqrt(5)*n)/log((1.0+sqrt(5))/2.0) -.1) - 2)

n=int(input())
maxigr=0
while n>1:
    if n%2==0:
        maxigr+=1
        n//=2
    else:
        n=(n+1)//2
        maxigr+=1
print(maxigr)

n = int(input())
k = 1
st = 0
while k < n:
    k *= 2
    st += 1
print(st)

n = int(input())

for i in range(70):
    if pow(2,i) < n and pow(2,i+1) >= n:
        print(i+1)

#n_init = int(input())
#n=n_init
def sieve(n):
    mark = [i % 2 for i in range(n)]
    mark[1] = 0
    mark[2] = 1
    for value in range(3,n,2):
        if mark[value] == 1:
            for i in range(value * 3, n, value * 2):
                mark[i] = 0
    return mark
def getPrimes(m):
    sieves = sieve(m)
    primes = [i for i, f in enumerate(sieves) if f]
    return primes, sieves
def isprime(n):
    """Returns True if n is prime."""
    if n == 2:
        return True
    if n == 3:
        return True
    if n % 2 == 0:
        return False
    if n % 3 == 0:
        return False

    i = 5
    w = 2

    while i * i <= n:
        if n % i == 0:
            return False

        i += w
        w = 6 - w

    return True
def find(n):
	for i in range(n, -1, -1):
		if isprime(i) and (i!=(n-1)):
			return i
def main(n_init):
	#n_init = int(input())
	n=n_init
	a = find(n)
	b = n-a
	print(a,b)
	result = 1
	while b != 0:
		n = b
		a = find(n)
		b = n-a
		result += 1
	'''
	if n_init%2:
		if result >3:
			result = 3
	elif n_init%2==0:
		if result >2:
			result = 2
	'''
	return result
print(main(97764))
print(isprime(97729))
'''
for i in range(2, 2000000000):
	re = main(i)
	if re > 3:
		print(re, i)
'''
#test

from math import ceil, log2

print(int(ceil(log2(int(input())))))

n = int(input())
import math
print(math.ceil(math.log2(n)))

n=int(input())
maxigr=0
if n==2:
    n=1
    print(1)
    exit()
elif n==3:
    n=1
    print(2)
    exit()
elif n==4:
    n=1
    print(2)
    exit()
elif n==5:
    n=1
    print(3)
    exit()
while n>1:
    if n%3==0:
        maxigr+=2
        n//=3
    elif (n-1)%3==0:
        n=(n-1)//3+1
        maxigr+=2
    else:
        n=(n-2)//3+1
        maxigr+=2
    if n<=5:
        if n==2:
            n=1
            maxigr+=1
            print(maxigr)
            exit()
        elif n==3:
            n=1
            maxigr+=2
            print(maxigr)
            exit()
        elif n==4:
            n=1
            maxigr+=2
            print(maxigr)
            exit()
        elif n==5:
            n=1
            maxigr+=3
            print(maxigr)
            exit()

from math import ceil, log
print(int(ceil(log(float(raw_input()), 2))))

#!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys, math, random, operator
from string import ascii_lowercase, ascii_uppercase
from fractions import Fraction, gcd
#from decimal import Decimal, getcontext
from itertools import product, permutations, combinations
from Queue import Queue, PriorityQueue
from collections import deque, defaultdict, Counter
#getcontext().prec = 100

MOD = 10**9 + 7
INF = float("+inf")

if sys.subversion[0] == "PyPy":
    import io, atexit
    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))
    sys.stdin = io.BytesIO(sys.stdin.read())
    raw_input = lambda: sys.stdin.readline().rstrip()
pr = lambda *args: sys.stdout.write(" ".join(str(x) for x in args) + "\n")
epr = lambda *args: sys.stderr.write(" ".join(str(x) for x in args) + "\n")
die = lambda *args: pr(*args) ^ exit(0)

read_str = raw_input
read_strs = lambda: raw_input().split()
read_int = lambda: int(raw_input())
read_ints = lambda: map(int, raw_input().split())
read_float = lambda: float(raw_input())
read_floats = lambda: map(float, raw_input().split())

"---------------------------------------------------------------"

def getpow(n):
    l = 0
    while (1 << l) < n:
        l += 1
    return l - 1

cache = {1: 0, 2: 1, 3: 2, 4: 2}
def get(n):
    if n not in cache:
        # l = 1
        # r = n-1
        # res = get(n//2)
        # while l <= r:
        #     mid = (l + r) / 2
        #     a, b = get(mid), get(n - mid)
        #     print mid, n - mid, ":", a, b, res
        #     if abs(a - b) <= 1:
        #         res = max(res, a)
        #         res = max(res, b)
        #     if a <= b + 1:
        #         l = mid + 1
        #     else:
        #         r = mid - 1
        # cache[n] = res
        a, b = get(n//2), get(n-n//2)
        cache[n] = max(a, b) + 1
        # if a == b:
        #     cache[n] = a + 1
        # else:
    return cache[n]

def todigits(n, d):
    res = []
    while n:
        res.append(n % d)
        n //= d
    return res[::-1]

def solve(n1, n2):
    # epr(n1, n2)
    if n1 == 1 and n2 == 0:
        return 0
    if n1 == 0:
        return 1 + solve(n2, 0)
    if n2 > n1:
        return 1 + solve(n2-n1, n1)
    elif n2 == n1:
        return 2 + solve(n1, 0)
    else:
        left = n1 - n2
        if left == 1:
            return 1 + solve(2, n2 - 1)
        elif left == 2:
            return 1 + solve(1, n2)
        else:
            if left % 3 == 0:
                return 2 + solve(n2 + n1 // 3, 0)
            elif left % 3 == 1:
                return 1 + solve(2, n2 + n1 // 3 - 1)
            elif left % 3 == 2:
                return 1 + solve(1, n2 + n1 // 3)

n = read_int()
print get(n)
# print solve(n, 0)

import math
n = int(raw_input())
x, i = 1, 0
while x < n:
    x, i = x * 2, i + 1
print i

from math import *
from sys import *
from queue import *
from decimal import *

n=int(input())
n-=2
left=0
right=n+2
while right-left>1:
  mid=(right+left)//2
  if (mid*mid-mid)//2<=n:
    left=mid
  else:
    right=mid
print(left)

#!/usr/bin/python

n = input()
p = 1
c = 1
while(p < n):
   p *= 2
   c += 1
print c - 1

import math
n = int(input())

res = 2
a = 2
b = 3
while(a+b<n):
    res+=1
    a,b = b,a+b

print(res)

n = input()
m = 2
ans = 1

while m<n:
    m *= 2
    ans += 1

print ans

import math
n=int(input())
t=math.log2(n)
if t.is_integer():
    print(int(t))
else:
    print(int(t)+1)

n, ans = int(input()), 0
while (n > 1):
    if n & 1:
        n = (n - 1) >> 1
        ans += 1
    else:
        n >>= 1
    ans += 1
print(ans)

from sys import stdin
n = int(stdin.readline())
ans = 0
cur = 1
while cur<n:
 ans+=1
 cur*=2
print ans

n = int(raw_input())
a, b = 0, 1
c = 0
while a < n:
	a, b = b+a, a
	c += 1
print(c-1)

import math
n, tot, odd = int(input()), 0, 1
while n-1:
    odd = min(odd,n&1)
    n = math.ceil(n/2);tot += 1;

print(tot-odd)

from math import *
n = int(input())
print(round(log(sqrt(5)*n + 1,(1.0+sqrt(5))/2.0))-3 )

n = input()
ans = 0

a = 1
b = 0
ans = 0
while a + b <= n:
    b = b * 2 + a - 1
    a = 2
    ans += 1

print ans - 1

from math import *
n = int(input())
if n == 4:
   print(2)
else:
   print(floor(log(sqrt(5)*n,(1.0+sqrt(5))/2.0) + .5)-2 )

player=int(input())
counter=1
rounds=1
value=0
while True:
    value+=counter
    if ( value >= player):
        print (rounds)
        break
    counter*=2
    rounds+=1

import math

# get line input split by space
def getLnInput():
    return input().split()

# ceil(a / b) for a > b
def ceilDivision(a, b):
    return (a - 1) // b + 1

def main():
    n = int(getLnInput()[0])
    print(math.ceil(math.log2(n)))
    return

main()

n = int(input())
a = [0 for i in range(1000)]
a[1] = 2
a[2] = 3
if n <4:
    print(n-1)
    exit()
i = 3
while True:
    a[i] = a[i-1] + a[i-2]
    if a[i] >= n:
        print(i - 1)
        exit()
    i += 1

def cal(n):
    if n == 2:
        return 1
    if n % 2 == 0:
        return cal(n / 2) + 1
    return cal(n / 2 + 1) + 1

n = int(raw_input())
print cal(n)

from math import log, ceil

x = int(raw_input())

print int(ceil(log(x, 2)))

import math
def main():
    n = int(input())
    phi = 0.6180339887498948482
    ans = 0
    while n > 1:
        n = round(n * phi)
        ans += 1
    print(ans)
main()

from math import log2, ceil
n = int (input())
print (ceil (log2 (n)))

import math
n = int(input())

res=1
if n>2:
    res=2

a = 2
b = 3
while(a+b<n):
    res+=1
    a,b = b,a+b

print(res)

n = int(input())

k = 2
m = 1

while k < n:
    k = k + k -1
    m = m + 1

if k > n:
    m = m - 1

print(m)

import math

n = (input())

N = int(n)
c = 0

while N > 1:
    N = N/2
    c = c+1

print (c)

#!/usr/bin/python

n = input()
p = 1
c = 1
while(p < n):
   p *= 2
   c += 1
print c - 1

from sys import stdin, stdout

n = int(stdin.readline())
ans = 0
while n != 1:
    ans += 1
    n = n // 2 + n % 2

stdout.write(str(ans))

n = int(input())
ans = 0
while n > 2 ** ans:
	ans += 1
print(ans)

import math
n = int(raw_input())
def ans(n):
    if n==2:
        return 1
    else:
        return ans(math.ceil(1.0*n/2))+1
print ans(n)

import math

n = raw_input()
n = int(n)

ans = 0;
while n>1:
	if(n%2!=0):
		ans += 2
		n = (n-3)/2 + 1
	else:
		ans += 1
		n = (n-2)/2 + 1

#print int(math.ceil((math.log(n,2))))
print int(ans)

n = int(raw_input())

count = 0
while n != 1:
    n = n/2 + n%2
    count += 1

print count

from math import *
n = int(input())
print(round(log(sqrt(5)*n)/log((1.0+sqrt(5))/2.0)) - 2)

n = int(raw_input())
k = 1
a = 1; b = 2
while a + b <= n:
	c = a + b
	b = a
	a = c
	k += 1
print k

n = int(raw_input())
a, b = 1, 1
c = 0
while a < n:
	a, b = b+a, a
	c += 1
print(c-1)

from sys import stdout
n = int(input())
dp = [0 for i in range(n // 2 + 10)]
dp[1] = 1
dp[2] = 2

for i in range(3, n + 10):
    if dp[i - 1] > n:
        stdout.write(str(i - 2))
        break
    dp[i] = dp[i - 1] + dp[i - 2]

from math import *
n = int(input())

print(floor(log(sqrt(5)*n,(1.0+sqrt(5))/2.0) )-2 )

# get line input split by space
def getLnInput():
    return input().split()

# ceil(a / b) for a > b
def ceilDivision(a, b):
    return (a - 1) // b + 1

def main():
    n = int(getLnInput()[0]) - 2
    ans = 1
    while n >= ans:
        n -= ans
        ans += 1
    print(ans)
    return

main()

import math
n = int(input())

dp = [0 for _ in range(n+1)]
dp[2] = 1
for i in range(3,n+1):
    dp[i] = 1 + dp[math.ceil(i/2)]

print(dp[n])

import math
n = int(input())
c=0
while(n!=1):
    if(n%2!=0):
        c=c+1
    c=c+1
    n=n//2
print(c)

from math import *
n = int(input())

print(round(log(sqrt(5)*n,(1.0+sqrt(5))/2.0) - .455)-2 )

n = int(input())
a = [0 for i in range(1000)]
a[1] = 2
a[2] = 3
i = 3
while True:
    a[i] = a[i-1] + a[i-2]
    if a[i] > n:
        print(i - 1)
        exit()

n = input()
ans = 0

a = 1
b = 0
ans = 0
while a + b <= n:
    b = b * 2 + a - 1
    a = 2
    ans += 1

print ans - 1

n = int( input() )

F = [1,1]

while F[-1] < n:
	F.append( F[-1] + F[-2] )

s = 0
for i in range( len(F) ):
	s += F[i]
	if s > n:
		print( i )
		break

from math import ceil, log2
n = int(input())

print(ceil(log2(n)))

from math import ceil as c

n = int(input())
n -= 1
x = -1 + (1 + 2 * 4 * n)** .5
x /= 2
print(c(x))

n = int(input())
a = [0 for i in range(1000)]
a[1] = 2
a[2] = 3
if n <4:
    print(n-1)
    exit()
i = 3
while True:
    a[i] = a[i-1] + a[i-2]
    if a[i] >= n:
        print(i)
        exit()

n = int(input())

def count(i):
    if i == 2:
        return 1
    return 1 + count(i//2 + i%2)

print(count(n))