N = int(input()) C = list(map(int, input().split(' '))) A = 0 K = sum(C) S = K // 10 for i in C: if i <= S: A += 1 else: continue kotae = A * 30 print(kotae)