def my_round(x:int): return int((x * 2 + 1) // 2) input() votes = [int(x) for x in input().split()] base = my_round(sum(votes) / 10) payment = 30 * len([x for x in votes if x <= base]) print(payment)