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