For this Question: Given an integer array A of size N initially. We take the GCD of all adjacent elements. Now we obtain N-1 integers. Take this array as new array A. Keep repeating this process until you obtain an array of only 1 element. Find that last element that you get.

See explanation of example section for more clarity.First line contains an integers N.
Next line contains N space separated integers denoting elements of array.

Constraints
1 <= N <= 10^5
0 <= Ai<= 10^9Print the last element remaining.Sample Input 1:
3
1 2 3

Output 
1

Explanation:
Array ={1, 2, 3}
Taking GCD of adjacent elements, Array ={1, 1}
Taking GCD of adjacent elements, Array ={1}
Now we stop as only one element is left. 

Sample Input 2:
6
3 6 6 9 3 3

Output 
3

Explanation
Array ={3, 6, 6, 9, 3, 3}
Taking GCD of adjacent elements, Array ={3, 6, 3, 3, 3}
Taking GCD of adjacent elements, Array ={3, 3, 3, 3}
Taking GCD of adjacent elements, Array ={3, 3, 3}
Taking GCD of adjacent elements, Array ={3, 3}
Taking GCD of adjacent elements, Array ={3}
Now we stop as only one element is left., I have written this Solution Code: import java.io.*;
import java.util.*;
import java.math.BigInteger;  

class Main {
    static int gcd(int a, int b)
    {
      if (b == 0)
        return a;
      return gcd(b, a % b);
    }
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int [n];
		int ans=0;
		for(int i=0;i<n;i++){
		    a[i]=sc.nextInt();
		    ans=gcd(ans,a[i]);
		}
	    System.out.print(ans);
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?