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