import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. int totalMaxCount = 0; for (int i = 0; i < a.length; i++) { totalMaxCount += maxMoves(a[i]); } return totalMaxCount; } static long maxMoves(long x) { // get factors in power of 2's int powerOfTwo = 1; int maxCount = 0; if (x == 1){ return 1; } if (!isEven(x)) { return x + 1; } while (isEven(x)) { x = x / 2; powerOfTwo = powerOfTwo * 2; } return 1 + (x * ((powerOfTwo * 2) - 1)); } static boolean isEven(long y) { return (y % 2) == 0; } 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(); } }