```
package gcd;
import java.io.*;
class gcd
{
public static void main (String args []) throws IOException
{
BufferedReader dataIn= new BufferedReader(new InputStreamReader(System.in));
String strEntry;
String str_C;
String ans;
int a[] = new int[10000];
int n=0,i=0,j=0,c=0,max=0,min=0;
long prod=0;
strEntry = dataIn.readLine();
n = Integer.parseInt(strEntry);
for(i=1;i<=n;i++)
{
str_C = dataIn.readLine();
c = Integer.parseInt(str_C);
if(c>0)
a[i]=c;
else
{
System.out.print("Invalid Entry");
return;
}
}
max=a[1];
for(i=1;i<=n;i++)
if(a[i]>=max)
max=a[i];
min=a[1];
for(i=1;i<=n;i++)
if(a[i]<min)
min=a[i];
for(i=1,prod=1;i<=n;i++)
prod=prod*a[i];
System.out.println();
for(i=max;i<=prod;i+=max)
{
c=0;
for(j=1;j<=n;j++)
if(i%a[j]==0)
c+=1;
if(c==n)
{
}
}
for(i=min;i>0;i--)
{
if (min%i==0)
{
c=0;
for(j=1;j<=n;j++)
if(a[j]%i==0)
c+=1;
}
if(c==n)
{
System.out.print(i);
break;
}
}
}
}
```

**input**

100

2 2 2 2 2 ......2**output**

1

Why did not output 2**Please help me**