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