#C13106. Find the Largest Peripheral Square

    ID: 42608 Type: Default 1000ms 256MiB

Find the Largest Peripheral Square

Find the Largest Peripheral Square

Given an array of integers, your task is to find the largest square number that divides every element of the array. First, compute the greatest common divisor (GCD) of the array elements. Then, among all perfect squares that are divisors of the GCD, output the largest one. A perfect square is any number of the form ( m^2 ) where ( m ) is an integer. For example, (1, 4, 9, 16, ) and so on are perfect squares.

inputFormat

The input is given via standard input (stdin). The first line of input contains a single integer ( n ) representing the number of elements in the array. The second line contains ( n ) space-separated positive integers.

outputFormat

Output a single integer via standard output (stdout) which is the largest perfect square divisor of the greatest common divisor of the given array.## sample

3
4 9 16
1

</p>