n = int(input()) s = [int(i) for i in input().split()] c = 1 for a in s: c *= a c = sum([int(i) for i in str(c)]) print(c)