N = int(input())
C = list(map(int,input().split()))
ALL = sum(C)
counter = 0
for i in range(N) :
    if C[i] <= ALL/10 :
        counter += 1
print(counter*30)