Discussion About Simple HCF

This is Discussion thread about Simple HCF

Test case 0 is showing wrong answer. Please explain why??

package HackerBlocks;

import java.util.Scanner;

public class Hcf {

public static void main(String[] args) {
	int times=0;
	Scanner scan=new Scanner(System.in);
	if(scan.hasNextInt())
		times=scan.nextInt();
	int n[]=new int[times];
			
	for(int z=0;z<times;z++) {
		n[z]=scan.nextInt();
	}
	
		for(int i=2;;) {
		int count=0;
		for(int j=0;j<times;j++) {
				if(n[j]%i==0) {
					count++;
				}
		}
		if(count==n.length) {
		System.out.println(i);
				break;
			}else
				i++;
		}
	
}

}