#B4065. Maximum Digit Sum

    ID: 11722 Type: Default 1000ms 256MiB

Maximum Digit Sum

Maximum Digit Sum

You are given n positive integers. For each integer, compute its digit sum (i.e. the sum of all its digits). For example, for the number \(12345\), the digits are \(1,2,3,4,5\) and the digit sum is computed as

[ 1+2+3+4+5=15 ]

Your task is to determine the maximum digit sum among the provided integers.

inputFormat

The first line contains one integer n (the number of integers). The second line contains n positive integers separated by spaces.

outputFormat

Output a single integer which is the maximum digit sum among the given numbers.

sample

3
12345 99 10
18

</p>