import java.util.Scanner;
import java.util.Arrays;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();

        long[] arr = new long[n];

        if (n == 1) {
            System.out.println(0);
            System.exit(0);
        }

        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextLong();
        }

        Arrays.sort(arr);
        int ans = 0;
        for (int i = n - 1; i > 0; i--) {
            while(arr[i] != arr[0]) {
                if (arr[i] < arr[0]) {
                    arr[0] /= 2;
                    ans++;
                    continue;
                }
                arr[i] /= 2;
                ans++;
            }
        }

                for (int i = n - 1; i > 0; i--) {
            while(arr[i] != arr[0]) {
                if (arr[i] < arr[0]) {
                    arr[0] /= 2;
                    ans++;
                    continue;
                }
                arr[i] /= 2;
                ans++;
            }
        }

        System.out.println(ans);
    }
}