/* ###### ###### ##### ###### ###### ##### # # # # # # # # # # # # # # # # # ## # # ## # # # # # # # # # # # # # ###### # # # # # # # # # # */ import java.util.*; import java.io.*; class strangeFunc { public static void main(String args[] ) throws Exception { //FastReader scan=new FastReader(); Scanner scan = new Scanner(System.in); PrintStream p = System.out; //p.println(); boolean b1 = false,b2=false; int n =scan.nextInt(); int []arr = new int[n+1]; for(int i=1;i<=n;i++){ arr[i] = scan.nextInt(); } int max1 =0; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ int gcd = findGCD(arr,i,j); int sum = sum(arr,i,j); int max = max(arr,i,j); int func = gcd*(sum-max); //func = func; //p.println(i+" "+j+" "+func); if(max1max){ max = arr[i]; } } return max; } static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while (st == null || !st.hasMoreElements()){ try{ st = new StringTokenizer(br.readLine()); } catch (IOException e){ e.printStackTrace(); } } return st.nextToken(); } int nextInt(){ return Integer.parseInt(next()); } long nextLong(){ return Long.parseLong(next()); } double nextDouble(){ return Double.parseDouble(next()); } String nextLine(){ String str = ""; try{ str = br.readLine(); } catch (IOException e){ e.printStackTrace(); } return str; } } }