#include <iostream>
using namespace std;
int main()
{
long long n, num;
cin >> n;
int ans = 0;
while (n--)
{
scanf("%lld", &num);
int sum = 0;
while (num)
{
sum += num % 10;
num /= 10;
}
ans = max(ans, sum);
}
cout << ans;
return 0;
}