#!/bin/python import sys def longestSequence(a): # Return the length of the longest possible sequence of moves. count = [] prime=[] for i in a: new_j=[] for num in range(1,i+1): if i%num==0: prime.append(num) for j in prime: while True: if i==1: new_j.append(1) break elif i%j==0: new_j.append(j) i = i//j elif i%j==1: new_j.append(i) break else: break count.append(sum(new_j)) maximum = sum(count) return maximum if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result