#Lutece3000. 添数游戏

添数游戏

Migrated from Lutece 3000 添数游戏

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

塔菲在和东雪莲玩一个游戏。 塔菲给了东雪莲一个集合SS和一个数nn。初始集合中只有一个数11,每次操作东雪莲可以从集合中选择两个数AABBAABB可以相等),然后将A+BA+B加入集合或者AB|A-B|加入集合。 请问东雪莲最少需要多少次操作才能使nn在集合中?

Input

一个整数nn

Output

一个整数,代表最少需要的操作次数

Samples

输入数据 1

31

输出数据 1

6

Constraints

1n200001 \leq n \leq 20000

Resources

2023 UESTC ICPC Training for Search and Dynamic Programming