Mex Permutations
Initially, there is an array of integers. It is known, that all its elements are in range and they are pairwise distinct. In other words, is a permutation.
Let's denote the minimal non-negative integer that does not belong to the set . For example, = , = , = .
Array is being built in such a way, that = . Let's denote = .
It is quite easy to build array by given array , but unfortunately, array was lost. You wanted to restore it using array , but there appeared to be too many possible arrays. You want to know how many arrays exists, such that = modulo .
Input
The first line of input contains one integer () — length of the permutation.
The second line of input contains integers () — elements of array .
Output
Print one integer — number of arrays that satisfy = modulo .
Examples
Scoring
( points): ;
( points): for all ;
( points): ;
( points): ;
( points): ;
( points): ;
( points): no additional restrictions.