import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import Data.List
import Data.Array.IO
import Control.Monad

type Memo = IOUArray Int Int

modN = 10^9+7

main = do
  n <- readLn :: IO Int
  a <- getIntListBC
  check <- newArray (1, n) 0 :: IO Memo
  l <- numbering check a 1
  let k = [1..n+1]
      dup = n - l - 1
  combN1 <- newArray (0, div (n+1) 2) 0 :: IO Memo
  combD <- newArray (0, div dup 2) 0 :: IO Memo
  foldM (comb (n+1)) combN1 [0..(div (n+1) 2)]
  foldM (comb dup) combD [0..(div dup 2)]
  ans <- mapM (solve combN1 combD n l) k
  putStr $ unlines . map show $ ans

bsToInt :: BC.ByteString -> Int
bsToInt = fst . fromJust . BC.readInt

getIntListBC :: IO [Int]
getIntListBC = map bsToInt . BC.words <$> BC.getLine

numbering :: Memo -> [Int] -> Int -> IO Int
numbering memo [] n = return 0
numbering memo (i:is) n = do
  c <- readArray memo i
  case c of
    0 -> do
      writeArray memo i n
      return =<< numbering memo is $ n + 1
    _ -> do
      return $ n - c - 1

comb :: Int -> Memo -> Int -> IO Memo
comb n memo 0 = do
  writeArray memo 0 1
  return memo
comb n memo k = do
  pre <- readArray memo (k-1)
  writeArray memo k $ flip mod modN $ flip div k $ pre * (n+1-k)
  return memo

readComb :: Memo -> Int -> Int -> IO Int
readComb memo n k
  | div n 2 >= k = readArray memo k
  | otherwise    = readArray memo (n-k)

solve :: Memo -> Memo -> Int -> Int -> Int -> IO Int
solve combN1 combD n l k
  | k == 1 = return n
  | n - l >= k = do
    x <- readComb combN1 (n+1) k
    y <- readComb combD (n-l-1) (k-1)
    return $ x - y
  | otherwise = readComb combN1 (n+1) k
