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