Question
GCD Hunt

Lila is given an array arr of size N. Determine if there exists any subarray in arr with a greatest common divisor (GCD) equal to 1.

Input
The first line of the input contains a single integer N.
The second line of the input contains N space-separated integers.
Output
Print "YES" if there is any subarray in the array whose GCD is equal to 1, else print "NO", without the quotes.
Example
Sample Input
5
6 2 5 3 1
Sample Output
YES
Sample Explanation
The subarray {2, 5} has gcd 1. Similarly [2, 5, 3], [1], etc. are also the possible answers.

Online