import scala.annotation.tailrec
object Main extends App {
  import scala.io.StdIn._
  val n = readInt()
  val interval = readLine.trim.split(' ').map(_.toLong)
  println((1 until 1 << n).count{pattern ⇒
    val (present, absent) = (0 until n).partition(i ⇒ (pattern & (1 << i)) != 0)
    val minSpan = present.map(interval).reduce(lcm)
    absent.forall(i ⇒ minSpan % interval(i) != 0)
  })
  @tailrec def gcd(a: Long, b: Long): Long = {
    b match {
      case 0 ⇒ a
      case _ ⇒ gcd(b, a % b)
    }
  }
  def lcm(a: Long, b: Long): Long = {
    a / gcd(a, b) * b
  }
}

