#C7444. Equalizing the Sequence Using GCD

    ID: 51316 Type: Default 1000ms 256MiB

Equalizing the Sequence Using GCD

Equalizing the Sequence Using GCD

You are given a sequence of positive integers. Your task is to determine whether it is possible to make all elements of this sequence equal by applying the allowed operation.

The operation in question is implicitly defined via the use of the greatest common divisor (GCD). More precisely, for a sequence \(a_1, a_2, \dots, a_n\), if \(\gcd(a_1, a_2, \dots, a_n) > 1\), then it is possible to perform a series of operations that equalize all elements, and you should output YES; otherwise, output NO.

For example, consider the sequence [2, 4, 6]. Its GCD is \(2\), which is greater than \(1\), so the answer is YES.

inputFormat

The first line contains an integer \(n\) (\(1 \leq n \leq 10^5\)), representing the number of elements in the sequence.

The second line contains \(n\) space-separated positive integers, each representing an element of the sequence.

outputFormat

Output a single line: YES if it is possible to equalize all the elements using the allowed operations (i.e., if the GCD of all elements is greater than \(1\)); otherwise, output NO.

## sample
1
7
YES