Henry is a historian who studies the history of sports, and of football in particular. Whenever he finds the standings table of a football tournament, he stores it in his database.
Recently he came across the standings of a small tournament. Unfortunately, the individual game results had been lost; the only surviving information was the number of points earned by each team.
Curious, he decides to work out in how many different ways the games of the tournament could have ended. He does not care about the exact scores of the games — only about who won each game.
The tournament followed these rules:
For example, suppose there are 3 teams and each finished with 3 points. Then there are exactly two possible outcome tables:
| Team | A | B | C | Points |
|---|---|---|---|---|
| A | - | 3 | 0 | 3 |
| B | 0 | - | 3 | 3 |
| C | 3 | 0 | - | 3 |
| Team | A | B | C | Points |
|---|---|---|---|---|
| A | - | 0 | 3 | 3 |
| B | 3 | - | 0 | 3 |
| C | 0 | 3 | - | 3 |
Help Henry compute the number of different possible outcome tables, ignoring the exact scores of the games.
The first line contains an integer $n$, the number of teams in the tournament ($2 \le n \le 8$). Each of the following $n$ lines contains one integer — the number of points earned by the corresponding team.
Print one integer: the number of possible outcome tables that produce the given point totals. It is guaranteed that at least one such table exists.