Type: Default 1000ms 256MiB

舞会

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题面背景

圣诞节就要到了, 你们学校有圣诞舞会吗?

题目描述

nn 名同学, 每名同学都需要穿上自己喜欢的衣服去舞会展示自己, 第 ii 名同学喜欢的衣服是 1ai1 \sim a_i 之间的舞蹈服, 我们希望每个同学都穿着独一无二的舞蹈服, 一共有多少不同的穿衣方案?

注意: 答案可能很大, 需要对 998244353 求模

输入格式

第一行一个整数 nn, 表示有 nn 名同学

第二行有 nn 个整数 aia_i 表示第 ii 名喜欢穿 1ai1 \sim a_i 号衣服

输出格式

输出一个整数表示有多少种不同的穿衣方案.

样例 #1

样例输入 #1

3
4 7 3

样例输出 #1

45

提示

  • 1n2×105 1\le n \le 2 \times 10^5
  • 1ai1091 \le a_i \le 10^9