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