#t57. 数位和

数位和

Sum of Digits

Problem Description

Xiaoyang has nn positive integers. He wants to know the maximum digit sum among these numbers. The "digit sum" of a number is the sum of all its digits. For example, for the number 1234512345, its digits are 1,2,3,4,51,2,3,4,5; adding them gives 1+2+3+4+5=151+2+3+4+5=15, so the digit sum of 1234512345 is 1515.

Input Format

The first line contains a positive integer nn, the number of positive integers.

The next nn lines each contain a positive integer.

Output Format

Output the maximum digit sum among these positive integers.

Sample Input

3
16
81
10

Sample Output

9

Sample Explanation

Among the three numbers in the sample: the digit sum of 1616 is 1+6=71+6=7, of 8181 is 8+1=98+1=9, of 1010 is 1+0=11+0=1. The maximum is 99.

Constraints

For all data, 1≤n≤1051 \le n \le 10^5, and each positive integer does not exceed 101210^{12}.