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