import java.io._
import java.util.StringTokenizer

class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}

//  pas = pascal(n)
//  nCk = pas(k)
//  n = 0 に対応していない
object Pascal{
  val MOD = 1e9.toInt + 7

  def pascal(n: Int): Array[List[Int]] = {
    // 次の段を作る
    def makeNext(list: List[Int], res: List[Int]): List[Int] = {
      list match{
        case x :: Nil => (1 :: res).reverse
        case x :: y :: list2 => makeNext(y :: list2, ((x+y)%MOD) :: res)
        case _ => throw new Exception("invalid list")
      }
    }

    // n回再起
    def pascalFunc(list: List[Int], res: List[List[Int]]): Array[List[Int]] = {
      (list.length > n) match{
        case true  => res.reverse.toArray
        case false =>
          val tmp = makeNext(list, List(1))
          pascalFunc(tmp, tmp :: res)
      }
    }

    pascalFunc(List(1), List())
  }
}



object Main extends App {
  import Pascal._

  val pw = new PrintWriter(System.out)
  val in = new InputReader(System.in)
 
  val n = in.next().toInt
  val a = new Array[Int](n+1)
  for(i <- 0 to n)
    a(i) = in.next().toInt


  ////
  var dbl = -1
  val dp = new Array[Boolean](n+1)
  for (i <- 0 until n) {
    if(dp(i)) {
      dbl = i
    }
    else
      dp(i) = true
  }

  var li = -1; var ri = -1
  for (i <- 0 until n+1) {
    if(a(i) == dbl) {
      if(li == -1)
        li = i
      else
        ri = i
    }
  }

  val pas = pascal(n+1)

  pw.println(n)
  for (i <- 2 to n) {
    var ans = pas(i)
  }
  pw.println(1)

  pw.flush()
}
