1032: Divide by 2 or 3
Memory Limit:1024 MB
Time Limit:2.000 S
Judge Style:Text Compare
Creator:
Submit:22
Solved:10
Description
You are given a sequence of positive integers: .
You can choose and perform one of the following operations any number of times, possibly zero.
- Choose an integer such that and is a multiple of , and replace with .
- Choose an integer such that and is a multiple of , and replace with .
Your ob
Find the minimum total number of times you need to perform an operation to achieve the ob-1
instead.
Input
The input is given from Standard Input in the following format:
- All values in the input are integers.
Output
Print the answer.
Sample Input Copy
3
1 4 3
Sample Output Copy
3
HINT
Here is a way to achieve the ob
- Choose an integer such that is a multiple of , and replace with . becomes .
- Choose an integer such that is a multiple of , and replace with . becomes .
- Choose an integer such that is a multiple of , and replace with . becomes .