n = int(input()) li = list(map(int, input().split())) vote = sum(li) count = 0 for i in li: if i <= vote / 10: count += 1 print(count * 30)