#arc129d. [arc129_d]-1+2-1
[arc129_d]-1+2-1
Problem Statement
Given is an integer sequence of length : .
You can repeat the operation below any number of times.
- Choose an integer () and add to , respectively. Here, stands for , and stands for .
Determine whether it is possible to make every element of . If it is possible, find the minimum number of operations needed.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If it is impossible to make every element of , print -1
. If it is possible to do so, print the minimum number of operations needed.
Sample Input 1
Sample Output 1
We can achieve the objective in five operations, as follows.
- Do the operation with . Now we have .
- Do the operation with . Now we have .
- Do the operation with . Now we have .
- Do the operation with . Now we have .
- Do the operation with . Now we have .