#!/bin/python3 from functools import lru_cache import sys # Sieve of Eratosthenes pmax = 10**6 P = 2*[False] + (pmax-1)*[True] for i in range(2, int(pmax**0.5)+1): if P[i]: for j in range(i**2, pmax+1, i): P[j] = False primes = [i for i in range(2, pmax+1) if P[i]] @lru_cache(maxsize=None) def count(a): if a == 1: return 1 for p in primes: if not a % p: return a + count(a // p) return a + 1 def longestSequence(A): # Return the length of the longest possible sequence of moves. return sum(count(a) for a in A) if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)