charge = 30 N = int(input()) Cs = list(map(int, input().split())) Csum = sum(Cs) threshold = Csum // 10 print(len([1 for c in Cs if c <= threshold]) * charge)