import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long moves=0; for(int j=0;j st=new Stack<>(); for(int i=2; i<=n; i++){ while(n%i==0){ st.push(i); n = n/i; } } if(a[j]==1) moves+=1; else { long n1=a[j];int r=1; int s=1; while(st.size()>0) { int p=st.pop(); if(n1==a[j]) moves+=1; else{ moves+=(r*s); s=r*s; } n1=n1/p; r=p; } moves+=a[j]; } } return moves; } 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(); } }