n = int(input()) c = list(map(int,input().split())) border = sum(c) / 10 m = 0 for i in c: if i <= border : m += 30 print(m)