N = int(input()) C = list(map(int, input().split())) S = sum(C) // 10 ANS = 0 for I in C: if I <= S: ANS += 30 print(ANS)