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