import java.util.Scanner; class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); long sum = 0; for(int i = 0; i < n; i++) { sum += findSequence(scanner.nextLong()); } System.out.println(sum); } private static long findSequence(long a) { if(a == 1) { return 1; } else if(isPrime(a)) { return a + 1; } else { long x = 0; if(a % 2 == 0) { x = a / 2; } else { x = a / findMinimumPrime(a); } return a + findSequence(x); } } private static long findMinimumPrime(long number) { for(long i = 3; i <= number; i += 2) { if(number % i == 0) { return i; } } return number; } private static boolean isPrime(long number) { if(number <= 1) { return false; } if(number <= 3) { return true; } if(number % 2 == 0 || number % 3 == 0) { return false; } for(long i = 5; i * i <= number; i += 6) { if(number % i == 0 || number % (i + 2) == 0) { return false; } } return true; } }