import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    private int count2(int v, Map<Integer, Integer> m) {
        if (v % 2 == 1) return 0;
        else if (m.containsKey(v)) return m.get(v);
        else {
            int ret = (count2(v/2, m) + 1);
            m.put(v, ret);
            return ret;
        }
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }

        Map<Integer, Integer> m = new HashMap<Integer, Integer>();
        m.put(1, 0);
        m.put(2, 1);

        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            min = Math.min(min, count2(A[i], m));
        }

        System.out.println(min);

        return;
    }

} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
} Main public static void main(String[] args) {
        new Solver().run();
    } main {
        new Solver().run();
    } new Solver().run() new Solver().run new Solver() String[] args args class Solver {

    private int count2(int v, Map<Integer, Integer> m) {
        if (v % 2 == 1) return 0;
        else if (m.containsKey(v)) return m.get(v);
        else {
            int ret = (count2(v/2, m) + 1);
            m.put(v, ret);
            return ret;
        }
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }

        Map<Integer, Integer> m = new HashMap<Integer, Integer>();
        m.put(1, 0);
        m.put(2, 1);

        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            min = Math.min(min, count2(A[i], m));
        }

        System.out.println(min);

        return;
    }

} Solver private int count2(int v, Map<Integer, Integer> m) {
        if (v % 2 == 1) return 0;
        else if (m.containsKey(v)) return m.get(v);
        else {
            int ret = (count2(v/2, m) + 1);
            m.put(v, ret);
            return ret;
        }
    } count2 {
        if (v % 2 == 1) return 0;
        else if (m.containsKey(v)) return m.get(v);
        else {
            int ret = (count2(v/2, m) + 1);
            m.put(v, ret);
            return ret;
        }
    } if (v % 2 == 1) return 0;
        else if (m.containsKey(v)) return m.get(v);
        else {
            int ret = (count2(v/2, m) + 1);
            m.put(v, ret);
            return ret;
        } v % 2 == 1 v % 2 v 2 1 return 0; 0 if (m.containsKey(v)) return m.get(v);
        else {
            int ret = (count2(v/2, m) + 1);
            m.put(v, ret);
            return ret;
        } m.containsKey(v) m.containsKey m v return m.get(v); m.get(v) m.get m v {
            int ret = (count2(v/2, m) + 1);
            m.put(v, ret);
            return ret;
        } int ret = (count2(v/2, m) + 1); ret (count2(v/2, m) + 1) count2(v/2, m) count2 v/2 v 2 m 1 m.put(v, ret) m.put m v ret return ret; ret int v v Map<Integer, Integer> m m public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }

        Map<Integer, Integer> m = new HashMap<Integer, Integer>();
        m.put(1, 0);
        m.put(2, 1);

        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            min = Math.min(min, count2(A[i], m));
        }

        System.out.println(min);

        return;
    } run {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }

        Map<Integer, Integer> m = new HashMap<Integer, Integer>();
        m.put(1, 0);
        m.put(2, 1);

        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            min = Math.min(min, count2(A[i], m));
        }

        System.out.println(min);

        return;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            A[i] = sc.nextInt();
        } {
            A[i] = sc.nextInt();
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc Map<Integer, Integer> m = new HashMap<Integer, Integer>(); m new HashMap<Integer, Integer>() m.put(1, 0) m.put m 1 0 m.put(2, 1) m.put m 2 1 int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < N; i++) {
            min = Math.min(min, count2(A[i], m));
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            min = Math.min(min, count2(A[i], m));
        } {
            min = Math.min(min, count2(A[i], m));
        } min = Math.min(min, count2(A[i], m)) min Math.min(min, count2(A[i], m)) Math.min Math min count2(A[i], m) count2 A[i] A i m System.out.println(min) System.out.println System.out System System.out min return;
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    private int count2(int v, Map<Integer, Integer> m) {
        if (v % 2 == 1) return 0;
        else if (m.containsKey(v)) return m.get(v);
        else {
            int ret = (count2(v/2, m) + 1);
            m.put(v, ret);
            return ret;
        }
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }

        Map<Integer, Integer> m = new HashMap<Integer, Integer>();
        m.put(1, 0);
        m.put(2, 1);

        int min = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            min = Math.min(min, count2(A[i], m));
        }

        System.out.println(min);

        return;
    }

}