#!/bin/python3 import sys import math cache = {1:1, 7:8, 24:46, 6:10, 4:7} def longestSequence(a): # Return the length of the longest possible sequence of moves. total_moves = 0 for bar_size in a: total_moves += helper(bar_size) return total_moves def helper(bar_size): if bar_size in cache: return cache[bar_size] moves = 0 max_power = int(math.log(bar_size, 2)) max_2 = math.pow(2, max_power) while bar_size % max_2 and max_2 < bar_size: max_2 = max_2 // 2 num_split = bar_size // max_2 return num_split * helper(max_2) + 1 if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)