import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int gcd( int x,int y){ x = ( x > 0) ? x : -x; y = ( y > 0) ? y : -y; while(x != y) { if(x > y) x -= y; else y -= x; } // long z=x; return x; } static long maximumValue(int[] a) { // Return the maximum value of f among all subsegments [l..r]. int l,r,g,m,x=0,y,k; long max=0,sum=0,total=0,total1=0; for(l=0;l<(a.length);l++){ // System.out.println("Hai "+l); for(r=l;r y) x -= y; else y -= x; } x=gcd(x,a[g]); }*/ if(l!=r){ for(m=l;m<=r;m++){ if(mtotal) total=total1; // System.out.println(l+" "+r+" "+x+" "+sum+" "+max+" "+total); } // System.out.println("over "+l); // System.out.println("Hello"); } return total; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextInt(); } long result = maximumValue(a); System.out.println(result); in.close(); } }