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