N = int(input()) C = list(map(int, input().split())) x = sum(C) // 10 print(len([c for c in C if c <= x]) * 30)