#!/bin/python3 import sys def longestSequence(q): b=[] for i in q: l=[] a=2 sum1=i qwe=i while a<=i: if i%a ==0 : l.append(a) i=i/a pass else: a+=1 for j in l: qwe=qwe/int(j) sum1+=qwe b.append(int(sum1)) return sum(b) if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)