n = int(input()) c = list(map(int, input().split())) total = sum(c) if total == 0: print(n * 30) else: threshold = total / 10 count = 0 for votes in c: if votes <= threshold: count += 1 print(count * 30)