N = int(input()) C = list(map(int, input().split())) S = sum(C) // 10 L = [i for i in C if i <= S] print(len(L) * 30)