def get_digit_sum(n): result = 0 while n > 0: result += n % 10 n //= 10 return result def main(): length = int(input()) sequence = [get_digit_sum(int(x)) for x in input().split()] product = 1 for seq in sequence: product *= seq print(get_digit_sum(product)) if __name__ == '__main__': main()