N = int(input()) C = list(map(int,input().split())) target=sum(C)//10 ans=0 for c in C: if c<=target: ans+=30 print(ans)