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