#!/bin/python3 import sys from math import sqrt def longestSequence(a): # Return the length of the longest possible sequence of moves. tot = a + (a>1) i = 2 #print(tot,a,i,"start",file=sys.stderr) while sqrt(a) >= i: d,m = divmod(a,i) if not m: a = d tot += d else: i += 1 #print(tot,a,i,file=sys.stderr) return tot if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = sum(longestSequence(i) for i in a) print(result)