n = int(input())
c_ls = [int(c) for c in input().split()]

l = sum(c_ls) / 10
ct = len([c for c in c_ls if c <= l])

print(30 * ct)