x = input() y = input().split() lsts = [] for lst in y: lsts.append(int(lst)) def options (inp): ave = sum(inp) / 10 fine = 0 for per in inp: if ave >= per: fine = fine + 30 return fine print(options(lsts))