N = int(input()) a = list(map(int, input().split())) sm = sum(a) lim = sm / 10 cnt = 0 for i in range(N): if a[i] <= lim: cnt += 1 print(30 * cnt)