N = int(input()) C = list(map(int, input().split())) ans = 0 for i in range(N): if C[i] * 10 <= sum(C): ans += 30 print(ans)