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