Grouping
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Given an integer and integers , you should divide these numbers into groups and each group contains exactly two integers. Now define the weight of a group as the difference between the two integers in the group, and the weight of a dividing manner as the variance of the group weights. Determine the expectation value of the dividing manner weight modulo .

Here, the variance of numbers equals , where .

输入描述:

The first line contains one integer .

The second line contains integers .

输出描述:

Only one line containing one integer, denoting the answer.
示例1

输入

复制
2
2 2 3 4

输出

复制
748683265

说明

There are 3 dividing manners:

* (2_1, 2_2), (3, 4), the weights are 0, 1_{} respectively, and the variance is \frac{1}{4}

* (2_1, 3), (2_2, 4), the weights are 1, 2_{} respectively, and the variance is \frac{1}{4}

* (2_1, 4), (2_2, 3), the weights are 2, 1_{} respectively, and the variance is \frac{1}{4}

where 2_1 denotes the first 2 while 2_2 denotes the second 2_{} in sample input.

Hence, the answer is \frac{1}{3}(\frac{1}{4}+\frac{1}{4}+\frac{1}{4}) = \frac{1}{4} \equiv 748683265 \pmod{998244353}.