#!/bin/python3 import sys import math def longestSequence(a): count = 0 for i in a : if i % 2 != 0 and i != 1: count += i+1 elif i == 1: count += 1 else: x = 0 while i % (2**(x+1)) == 0: x+=1 if i/(2**x) == 1: count += 2*i -1 else: count += (i/(2**x))*(2*(2**x) - 1) + 1 return int(count) if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)