n = int(input()) c = list(map(int, input().split())) base = sum(c) // 10 + 1 ans = 0 for e in c: if e < base: ans += 30 print(ans)