Cells
时间限制:C/C++/Rust/Pascal 3秒,其他语言6秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

Cuber QQ got a table of infinite size. He will consider the table rows numbered from top to bottom through , and the columns numbered from left to right through . Then he'll denote the cell in row x and column y as (x, y).

Initially, there are n trucks at cell (0, a_i) respectively. The goal is that each of the trucks have to go to one of the n destinations, located at cell . Cuber QQ has to make sure that there are no two trucks at the same destination. In another word, any two paths of the trucks are non-intersecting (no common points).

Each truck can go from cell (x, y) to one of two cells (x + 1, y) and (x, y - 1). And the truck can't have any chance of meeting any other trucks along the way.

Now can you help Cuber QQ to find the number of ways that trucks can achieve this goal.

输入描述:

The first line contains one integer n (), where n is the number of trucks.

The second line contains n integers a_i (, ), which are the trucks' initial positions.

输出描述:

Print the number of ways modulo 998244353 on the only line of output.
示例1

输入

复制
3
1 2 3

输出

复制
4