#!/bin/python3 import sys def largestDivisor(a): lD = a for i in range(2,int(a)): if a%i==0: lD = i break return a/lD def longestSequence(bag): moves = 0 for a in bag: if a == 1: moves += 1 else: while a != 1: # get the rolling sum of divisors moves += a a = largestDivisor(a) moves += 1 return int(moves) if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)