n=int(input()) c=list(map(int,input().split())) x=sum(c) ans=0 for i in range(n): if x>=c[i]*10: ans+=1 print(ans*30)