n=int(input()) c=list(map(int, input().split())) mi=sum(c)//10 ans=sum(x <= mi for x in c)*30 print(ans)