n = int(raw_input())
l = map(int, raw_input().split())
t = sum(l)
c = 0
for i in l:
    if i*10 <= t:
        c += 30
print c