N = int(raw_input()) C = map(int, raw_input().split()) th = sum(C)/10 notback = 0 for i in range(N): if C[i] <= th: notback += 1 print 30*notback