import java.util.Scanner

import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val N = sc.nextInt()
    val A = 1 to N map (_ => sc.nextInt)

    val ans = Math.max(scan(A(0), A.drop(1)), scan(A(1), A.take(1) ++ A.drop(2)))
    println(ans)

  }

  def scan(t: Int, A: Seq[Int]): Int = {

    val mx = Math.sqrt(t).toInt + 1
    val candidates = (1 to mx).filter(t % _ == 0).flatMap(x => Seq(x, (t/x)))

    val map: mutable.Map[Int, Int] = mutable.Map(candidates.map(_ -> 0): _*)
    map.put(1, 0)
    A.foreach { a =>
      candidates.foreach { c =>
        {
          val d = if (a % c != 0) 1 else 0
          map.put(c, map.get(c).get + d)
        }
      }
    }
    val filtered = map.filter(_._2 <= 1)
    (map.filter(_._2 <= 1).keySet).max
  }
}