atcoder#ABC191F. [ABC191F] GCD or MIN
[ABC191F] GCD or MIN
Score : points
Problem Statement
There are integers written on a blackboard. You will do the following operation times:
- Choose two numbers written on the blackboard and erase them. Let and be the erased numbers. Then, write or on the blackboard.
After operations, just one integer will remain on the blackboard. How many possible values of this number are there?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of possible values of the last remaining number on the blackboard.
3
6 9 12
2
The possible values of the last remaining number are and . We will have in the end if, for example, we do as follows:
- choose and erase them from the blackboard, then write ;
- choose and erase them from the blackboard, then write .
Also, we will have in the end if, for example, we do as follows:
- choose and erase them from the blackboard, then write ;
- choose and erase them from the blackboard, then write .
4
8 2 12 6
1
is the only number that can remain on the blackboard.
7
30 28 33 49 27 37 48
7
, , , , , , and can remain on the blackboard.