n = int(input()) c =[int(i) for i in input().split()] vote = sum(c) tax = 0 for i in c: if i <= vote / 10: tax += 30 print(tax)