#!/bin/python import sys import math def longestSequence(a): t = 0 for v in a: while v > 1: t += v found = False ceil = int(math.ceil(math.sqrt(v))) d = 2 while d < ceil: if v % d == 0: found = True break d += 1 if found: v /= d else: v = 1 t += v return t if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result