import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static BigInteger longestSequence(long[] a) { BigInteger moves = BigInteger.ZERO; for(long l : a){ BigInteger b = sq(l); moves = moves.add(b); } return moves; } static BigInteger sq(long l){ List ll = new ArrayList<>(); long _l = l; long p = 2; BigInteger r = BigInteger.ONE; BigInteger s = BigInteger.ONE; while(l != 1 && p <= Math.ceil(Math.sqrt(_l))){ //System.out.println("L : " + l); //System.out.println("P : " + p); while(l % p == 0){ //System.out.println("Added : " + p); ll.add(p); l /= p; } p++; //System.out.println("Post L : " + l); //System.out.println("Post P : " + p); } if(l != 1){ ll.add(l); } ll.add((long) 1); /* for(long k : ll){ System.out.print(k + " "); } System.out.println(""); */ Collections.reverse(ll); for(long k : ll){ if(k == 1){ r = BigInteger.ONE; s = BigInteger.ONE; } else{ r = r.multiply(BigInteger.valueOf(k)); s = s.add(r); } } return s; } 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(); } BigInteger result = longestSequence(a); System.out.println(result.toString()); in.close(); } }