#!/bin/python3 import sys def recursiveBreakdown(stick): if stick == 1: return 1 if stick == 2: return 3 for x in range(2,stick): if stick % x == 0: #print(x) #print(int(stick/x)) return x + x * recursiveBreakdown(int(stick/x)) return 1 + stick def longestSequence(a): # Return the length of the longest possible sequence of moves. ret = 0 for stick in a: ret += recursiveBreakdown(stick) return ret if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)