import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long rec(long val) { long sol=val,k; k=(int)val/2; if(k==1) { return sol+1; } else{ return sol=sol+rec(k); } } static long longestSequence(long[] a) { long result=0,temp_result=0; int length=a.length; for (int i = 0; i < length; i++) { if(a[i]%2!=0&&a[i]>1) { temp_result=1+a[i]; result+=temp_result; } if(a[i]==1) { result+=1; } if(a[i]%2==0) { result+=rec(a[i]); } } return result; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n]; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextLong(); } long result = longestSequence(a); System.out.println(result); in.close(); } }