Background Story

Steven and Grace want to teach basic Mathematics to their baby daughter, Jane.
Grace bought "flash cards" that contains one or more dots.
Here are some examples of those cards:

Card 1:     Card 2:     Card 3:
-------     -------     -------
|     |     |   * |     |*  * |
|  *  |     |     |     |    *|
|     |     | *   |     |*  * |
-------     -------     -------

Card 1 is actually number 1, Card 2 is number 2, Card 3 is number 5.
The creator of these flash cards claim that babies can spot the number of dots faster than adults :O.

Problem Description

The issue here is that my wife Grace only bought N such cards, and some of them are the same :(.
Steven wants to teach more numbers to Jane...
Suddenly Steven realizes that he can actually combine two cards to produce a new number!!
For example, if Steven combines Card 1 and Card 3, he can teach Jane number: 1+5 = 6 :).
Being a computer scientist, Steven wonders, how many different numbers that he can teach to Jane by using single card and also by combining two cards?

Input

The input contains multiple test cases, one in each line.

Each test case starts with one integer, N (1 <= N <= 20), that denotes the number of flash cards bought by Grace.
Then immediately followed by N positive integers less than 10000 that denote the number of dots on each flash card.
These N flash cards are not necessarily unique as described in the problem description above.

Input ends with a dummy test case with N = 0. Ignore this one.

Output

For each test case, print an integer in one line to answer Steven's question above.

Sample Input

4   1 1 1 1
3   1 2 5
2   10 1
2   1 1
1   7
0

Sample Output

2
6
3
2
1

Problem Author

Steven Halim
This is an original and Steven will likely teach this to his baby daughter Jane sometime soon.