import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long alll(long x,long y) { int i=2; long ssum =0L; while((y*i)1) s=a[i]+1L; else s=a[i]; int rt=(int)Math.sqrt(a[i]); for(int j=2;j<=rt;j++) { if(a[i]%j == 0) { s=s+(long)(a[i]/j); s=s+alll(a[i],j); break; } } sum=sum+s; } return sum; } public static void main(String[] args) { 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 = longestSequence(a); System.out.println(result); in.close(); } }