#!/bin/python3 import sys def longestSequence(a): # Return the length of the longest possible sequence of moves. def splitup(stick, steps): #print('stick -> %d' % stick) steps.append(stick) if stick == 1: return i = 2 while stick % i != 0: i += 1 splitup(stick // i, steps) steps = [] for stick in a: splitup(stick, steps) return sum(steps) if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)