#!/bin/python import sys def memodict(f): class MemoDict(dict): def __missing__(self, key): ret = self[key] = f(key) return ret return MemoDict().__getitem__ @memodict def fx(l): if l==1: return 1 if l==2: return 3 t = l c = [] while t>1: if l%t == 0: c.append(1+t*fx(l/t)) t -= 1 return max(c) def longestSequence(a): return sum(fx(x) for x in a) # Return the length of the longest possible sequence of moves. if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result