#!/bin/python import sys def longestSequence(a): res=0 for n in a: primfac = [] d=2 reste = n while d*d <= reste: while (reste % d) == 0: primfac.append(d) reste /= d d += 1 if reste != 1 : primfac.append(reste) aux=1 incr = 1 primfac = primfac[::-1] for p in primfac: incr*=p aux+=incr res+=aux return res if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result