object Main extends App {
  import scala.io.StdIn._
  val n = readInt
  val balls = readLine.trim.split(' ').map(_.toInt)
  val odd = balls.count(_ % 2 == 1)
  val even = balls.count(_ % 2 == 0)
  if (odd == 0 || even == 0){
    println(0)
  }else {
    if (odd % 2 == 0) {
      println(n - 2)
    }else {
      println(n - 1)
    }
  }
}
