#!/bin/python import sys import math def longestSequence(a): # Return the length of the longest possible sequence of moves. s=0; for i in xrange(len(a)): s1=1; g=int(math.log(a[i],2)); if (2**g==a[i]): g-=1; j=g;piz=1; while (j>-1): if (a[i]%(int(2**j))==0): piz=int(2**j);break; j-=1; s1+=(a[i]/piz)*(2**(j+1)-1); if (a[i]==1): s1=1; s+=s1; return s if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result