#coding: utf-8 ##yuki_191 n=int(raw_input()) s=[] s=map(int,raw_input().split()) lt=list(s) l=lt[:n] total=sum(l) res=0 for i in xrange(n): if l[i]<=total/10: res+=30 print res