#!/bin/python3 import sys import math def longestSequence(a): sumo=0 # Return the length of the longest possible sequence of moves. for i in a: pick=i collect=0 if(i==1): sumo=sumo+1 else: while(i>=1): if(i==1): collect=collect+i i=i-1 if(i%2==0): collect=collect+i i=i//2 elif(i%2==1): collect=collect+i for ij in range(2,i+1): if(i%ij==0): i=i//ij break sumo=sumo+collect return(sumo) if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)