#K52787. Greatest Common Divisor of a List
Greatest Common Divisor of a List
Greatest Common Divisor of a List
Given a list of integers, your task is to compute the greatest common divisor (GCD) of all the numbers in the list. The GCD of two numbers \(a\) and \(b\), denoted by \(\gcd(a, b)\), is the largest integer that divides both \(a\) and \(b\) without leaving a remainder. For a list \( [a_1, a_2, \dots, a_n] \), you are to compute \(\gcd(a_1, a_2, \dots, a_n)\) by iteratively applying the GCD operation.
Input Format: The first line contains an integer \(n\) denoting the number of integers in the list. The second line contains \(n\) space-separated integers.
Output Format: Output a single integer representing the GCD of the list.
inputFormat
The input consists of two lines. The first line is an integer \(n\) which represents the count of numbers. The second line contains \(n\) space-separated integers.
outputFormat
Output a single integer which is the greatest common divisor of the given list of integers.
## sample4
12 15 18 27
3