#!/bin/python import sys import math def fact(x): result = [] i = 1 while i*i <= x: if x % i == 0: result.append(i) if x/i != i: result.append(x/i) i += 1 m=max(result) result.remove(m) return max(result) def choc(b): a=b if(b==1): return 1 else: g=0 while b>1: y=fact(b) g=g+y b=y return g+a def longestSequence(a): s=0 for x in range(0,len(a)): s=s+choc(a[x]) return s # 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 # Enter your code here. Read input from STDIN. Print output to STDOUT