N = int(raw_input()) c = map(int,raw_input().split()) money = 0 for i in c: if(i<=(sum(c)/10)): money += 30 print money