import java.util.Scanner; public class Solution { static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. int total = 0; for (long anA : a) { total += calc(anA); } return total; } static long calc(long a) { if (a == 1) { return 1; } if (a % 2 != 0) { return a + 1; } else { long currCount = 0; long dummyA = a; long lastGroup = 1; while (true) { if (a % 2 != 0) { return currCount + lastGroup + dummyA; } a /= 2; currCount = currCount + (lastGroup); lastGroup = a; } } } 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(); } }