n = int(input()) c = list(map(int, input().split())) cnt = 0 sum_c = sum(c) for ci in c: if ci <= sum_c/10: cnt += 30 print(cnt)