a=int(input()) b=[int(i) for i in input().split()] c=[] d=0 e=0 for i in b: c.append(i) d+=i for i in c: if i<=d//10: e+=1 print(30*e)