import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a) { /*ArrayList al=new ArrayList(); int i=1; while(i<=Math.sqrt(a[0])) { if(a[0]%i==0) { if(!al.contains(i) && !al.contains(a[0]/i))2 2 { al.add(i); al.add(a[0]/i); } } i++; }*/ return 0; } public static long get_max(long a,long num) { int r=2; long t=a; int count=1; long sum=0; while(t<=num) { sum=sum+t; count++; Double p=(a*(Math.pow(r,count-1))); t=p.intValue(); } return sum+1; } public static int primeFactors(long number) { Set primefactors = new HashSet<>(); long copyOfInput = number; for (int i = 2; i <= copyOfInput; i++) { if (copyOfInput % i == 0) { primefactors.add(i); copyOfInput /= i; i--; } } int max=Collections.max(primefactors); //System.out.println(max); return max; } public static void main(String[] args) { //System.out.print(primeFactors(24)); //get_max(3,24); Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n]; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextLong(); } long result=0; for(int i=0;i