CF279D The Minimum Number of Variables
Description
You've got a positive integer sequence $ a_{1},a_{2},...,a_{n} $ . All numbers in the sequence are distinct. Let's fix the set of variables $ b_{1},b_{2},...,b_{m} $ . Initially each variable $ b_{i} $ $ (1
Input Format
The first line contains integer $ n $ $ (1
Output Format
In a single line print a single number — the minimum number of variables $ m $ , such that those variables can help you perform the described sequence of operations.
If you cannot perform the sequence of operations at any $ m $ , print -1.
Explanation/Hint
In the first sample, you can use two variables $ b_{1} $ and $ b_{2} $ to perform the following sequence of operations.
1. $ b_{1} $ := $ 1 $ ;
2. $ b_{2} $ := $ b_{1}+b_{1} $ ;
3. $ b_{1} $ := $ b_{1}+b_{2} $ ;
4. $ b_{1} $ := $ b_{1}+b_{1} $ ;
5. $ b_{1} $ := $ b_{1}+b_{2} $ .