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