n = int(input()) c = list(map(int, input().split())) ans = 0 money = sum(c) // 10 for i in range(n): if c[i] <= money: ans += 30 print(ans)