object Main extends App {

  import scala.io.StdIn._
  import scala.math._

  val n = readLine.trim.toInt
  val numbers = readLine.trim.split(' ').map(_.toInt)
  val sorted = numbers.zipWithIndex.map{case (v, i) ⇒ ValueWithIndex(v, i)}.sorted
  val canMake = Array.tabulate(n){_ ⇒ 0}
  for (number ← numbers.distinct){
    val indices = (lowerBound(sorted, ValueWithIndex(number, 0)) until upperBound(sorted, ValueWithIndex(number, n))).map{i ⇒ sorted(i).index}
    for (k ← indices.indices){
      val left = indices(k) // (0 to left) にnumberがk
      val right = n - 1 - indices(indices.length - 1 - k) //(n - 1 - right until n) にnumberがk個含まれる最小インデックス
      if (right < left){
        canMake(right) -= 1
        canMake(left) += 1
      }else {
        canMake(left) -= 1
        canMake(right) += 1
      }
    }
  }
  for (i ← 1 until n){
    canMake(i) += canMake(i - 1)
  }
  println(
    canMake.zipWithIndex.filter{case (n, i) ⇒ n == 0}.map{case (_, i) ⇒ i + 1}.mkString(" ")
  )


  def lowerBound[T](array: Array[T], target: T)(implicit ordering: Ordering[T]): Int = {
    var left = 0
    var right = array.length
    while (left < right){
      val mid = (left + right) / 2
      if (ordering.compare(array(mid), target) < 0){
        left = mid + 1
      }else {
        right = mid
      }
    }
    right
  }
  def upperBound[T](array: Array[T], target: T)(implicit ordering: Ordering[T]): Int = {
    var left = 0
    var right = array.length
    while (left < right){
      val mid = (left + right) / 2
      if (ordering.compare(array(mid), target) <= 0){
        left = mid + 1
      }else {
        right = mid
      }
    }
    right
  }

  case class ValueWithIndex(value: Int, index: Int) extends Ordered[ValueWithIndex] {
    override def compare(that: ValueWithIndex): Int = if (value == that.value) index.compare(that.index) else value.compare(that.value)
  }

  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}
