#!/bin/python3 import sys def longestSequence(a): sum=0 for i in a: if i==1: sum=sum+1 elif i%2==1: sum=sum+i+1 elif i%2==0: while(i>1): sum=sum+int((i/2)*2) i=(i/2) return sum # 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)