Contest Duration: ~ (local time)
B - Exact Payment

Time Limit: 2 sec / Memory Limit: 256 MB

### 問題文

エキシビ商店では N 個の品物が売られています。 商品 i (1≦i≦N) の値段は A_i ミョンです。

このとき、高橋くんが財布に入れる必要のある硬貨の枚数の最小値を求めて下さい。ただし、財布に入れるための硬貨が足りなくなることは無いものとします。

### 制約

• 1≦N≦20,000
• 1≦A_i≦10^{12}

### 入力

N
A_1 A_2 ... A_N


### 出力

どのように買い物をしてもお釣りが出ないように財布の中に入れる必要のある硬貨の枚数の最小値を出力せよ。

### 入力例 1

3
43 24 37


### 出力例 1

16


### 入力例 2

5
49735011221 970534221705 411566391637 760836201000 563515091165


### 出力例 2

105


Score : 1500 points

### Problem Statement

The currency used in Takahashi Kingdom is Myon. There are 1-, 10-, 100-, 1000- and 10000-Myon coins, and so forth. Formally, there are 10^n-Myon coins for any non-negative integer n.

There are N items being sold at Ex Store. The price of the i-th (1≦i≦N) item is A_i Myon.

Takahashi is going to buy some, at least one, possibly all, of these N items. He hates receiving change, so he wants to bring coins to the store so that he can pay the total price without receiving change, no matter what items he chooses to buy. Also, since coins are heavy, he wants to bring as few coins as possible.

Find the minimum number of coins he must bring to the store. It can be assumed that he has an infinite supply of coins.

### Constraints

• 1≦N≦20,000
• 1≦A_i≦10^{12}

### Input

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

N
A_1 A_2 ... A_N


### Output

Print the minimum number of coins Takahashi must bring to the store, so that he can pay the total price without receiving change, no matter what items he chooses to buy.

### Sample Input 1

3
43 24 37


### Sample Output 1

16


There are seven possible total prices: 24, 37, 43, 61, 67, 80, and 104. With seven 1-Myon coins, eight 10-Myon coins and one 100-Myon coin, Takahashi can pay any of these without receiving change.

### Sample Input 2

5
49735011221 970534221705 411566391637 760836201000 563515091165


### Sample Output 2

105