/*
* a) 2020
* b) 1234 1235
*/
#include <iostream>
int main() {
size_t i, m, x, n;
std::cin >> n;
m = 0;
for (i = 1; i <= n; ++i) {
std::cin >> x;
while (x % 10 > (x / 10) % 10)
x /= 10;
m += x;
}
if (m > 0)
std::cout << m;
else
std::cout << "niciunul";
}