Hide

Problem I
Eilíf æska

Languages en is

Hildur enjoys mixing drinks and has now created the drink eternal youth. She poured the drink into a few glasses and intends to share it with some friends. After having poured into the glasses she noticed there isn’t an equal amount between all the glasses. To make sure everything is fair she has to fix this by pouring from one glass to another, as often as needed, until all are equal. When she pours from glass $i$ to glass $j$ then glass $i$ has to contain at least as much as glass $j$. She stops pouring from glass $i$ into glass $j$ when they have become equal. Help Hildur and her friends obtain eternal youth.

Input

The first line of input contains a single integer $n$ where $1 \leq n \leq 4$. Then there is a single line with $n$ integers $a_i$, the amount of liquid in the $i$-th glass in milliliters. It is guaranteed that $0 \leq a_i \leq 10^8$.

Output

If there is no solution print $-1$. Otherwise print an integer $0 \leq k \leq 1000$ giving the number of pourings between glasses. If the problem is solvable it can be done in at most $1000$ operations. Next you should print $k$ lines with two integers $1 \leq i, j \leq n$ each, denoting that one is to pour from glass $i$ to glass $j$ until they have the same amount of liquid. The answer is considered correct if all glasses contain an equal amount of liquid after all the operations, assuming all the operations are valid. If an operation refers to a glass that does not exist or pours from glass $i$ to glass $j$ when there is less in glass $i$ than in glass $j$ then the operation is considered invalid.

Scoring

Group

Points

Constraints

1

50

$1 \leq n \leq 2$

2

50

$3 \leq n \leq 4$

Sample Input 1 Sample Output 1
2
3 5
1
2 1
Sample Input 2 Sample Output 2
4
100 200 200 100
2
3 4
2 1