#!/bin/python3 import sys def recur_choco(ch): if(ch == 1): return 1 else: max_steps = 0 for i in range(2, ch + 1): if(ch % i == 0): recur_result = recur_choco(int(ch / i)) res = recur_result * i + 1 if(res > max_steps): max_steps = res return max_steps def longestSequence(a): # Return the length of the longest possible sequence of moves. total = 0 for ch in a: total += recur_choco(ch) return total if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)