import math def breaking(bar): pieces = 1 moves = 0 while bar: if bar == 1: moves += pieces break if bar % 2 != 0: moves += pieces * (bar + 1) break factor = 2 for f in range(2, bar // 2, 2): if bar % f == 0 and (bar // f) % 2 != 0: factor = bar // f break moves += pieces bar = bar // factor pieces *= factor return moves def longestSequence(a): return sum(map(breaking, a)) if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)