# -*- coding: utf-8 -*- N = int(input()) C = list(map(int, input().split())) total = sum(C) / 10 answer = 0 for v in C: answer += 30 if v<=total else 0 print(answer)