//
//  main.swift
//  AtCoder
//
//  Created by nakailand on 2020/08/19.
//  Copyright © 2020 nakailand. All rights reserved.
//

import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readTwoInts() -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: " ").map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

func prime_factor(n: Int) -> [Int] {
    var ret: [Int] = []
    var k = n
    for i in 2..<Int(sqrt(Double(n)))+1 {
        while k % i == 0 {
            ret.append(i)
            k = Int(floor(Double(k / i)))
        }
    }
    
    if k != 1 {
        ret.append(k)
    }
    
    return ret
}

let N = readInt()
var A = readInts()
var ans = 1000000007
for a in A {
    ans = min(prime_factor(n: a).filter { $0 == 2 }.count, ans)
}

print(ans)
