#!/bin/python import sys def max_factor(n): primeFactor = 1 i = 2 while i <= (n / i): if n % i == 0: primeFactor = i n /= i else: i += 1 if primeFactor < n: primeFactor = n return primeFactor def longestSequence(x): # Return the length of the longest possible sequence of moves. moves=0 n=x while(x>0): if(x==max_factor(x)): if n==1: moves = 1 else: moves+=(x+1)*(n/x) x=0 else: moves+=n/x x=x/max_factor(x) return moves if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result=0 for x in a: result += longestSequence(x) print result