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