#ARC159C. [ARC159C] Permutation Addition

[ARC159C] Permutation Addition

Score : 500500 points

Problem Statement

You are given a sequence of positive integers: A=(a1,,aN)A=(a_1,\ldots,a_N).

Determine whether it is possible to make all elements of AA equal by repeating the following operation between 00 and 10410^4 times, inclusive. If it is possible, show one way to do so.

  • Choose a permutation (p1,,pN)(p_1,\ldots,p_N) of (1,,N)(1,\ldots,N), and replace AA with (a1+p1,,aN+pN)(a_1+p_1,\ldots,a_N+p_N).

Constraints

  • 2N502 \leq N \leq 50
  • 1ai501 \leq a_i \leq 50
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN

a1a_1 \ldots aNa_N

Output

If it is impossible to make all elements of AA equal, print No. If it is possible, print one way to do so in the following format, where MM is the number of operations, and (pi,1,,pi,N)(p_{i,1},\ldots,p_{i,N}) is the permutation chosen in the ii-th operation:

Yes

MM

p1,1p_{1,1} \ldots p1,Np_{1,N}

\vdots

pM,1p_{M,1} \ldots pM,Np_{M,N}

If multiple solutions exist, you may print any of them.

2
15 9
Yes
8
1 2
1 2
1 2
1 2
2 1
1 2
1 2
1 2

This sequence of 88 operations makes A=(24,24)A = (24,24), where all elements are equal.

5
1 2 3 10 10
No
4
1 1 1 1
Yes
0

All elements of AA are equal from the beginning.