import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    sc.nextLine()
    val monsters = sc.nextLine.split(" ").map(_.toInt)
    if (monsters.length == 2 & monsters.distinct.length == 2) println(0)
    else if (monsters.distinct.length == 1) println(monsters(0))
    else if (monsters.count(_ % 2 == 0) == monsters.length) println(2)
    else println(1)
  }
}
