#!/bin/python3 import sys from math import sqrt from functools import reduce import functools @functools.lru_cache(maxsize=None) def factors(n, total=0): if n == 1: total += 1 return total if n % 2 == 0: largest = n // 2 total += n return factors(largest, total) else: a = sorted(set(reduce(list.__add__,([i, n//i] for i in range(1, int(sqrt(n))+1) if n % i == 0)))) total += a[-1] return factors(a[-2], total) def longestSequence(a): result = 0 for i in a: result += factors(i) return result # 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)