n = int(input()) c = list(map(int,input().split())) s = sum(c) cnt=0 for e in c: if e <= s/10: cnt +=1 print(cnt*30)