#!/bin/python import sys def longestSequence(a): s=0 # Return the length of the longest possible sequence of moves. for i in a: s+=(i+part(i)) return(s) def part(a): if a==1: return 0 else: if a%2!=0: return(1+a) else: a=a/2 if(a%2==0): return(1+2*part(a)) else: return(1+a) if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result