#!/bin/python3 import sys def longestSequence(a): f=0 for i in range(len(a)): s=1 p=a[i] if(a[i]==1): p=0 else: for o in range(2,a[i]): if(a[i]%o==0): k=a[i]/o #no divided s+=s*k #no of moves a[i]=o break s+=p f+=s return int(f) # Return the length of the longest possible sequence of moves. if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)