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