N = input() C = map(int,raw_input().split()) give_back = 0 total_vote = sum(C) sta_vote = total_vote/10. for i in range(0,N): if C[i] <= sta_vote: give_back += 30 print give_back