N = int(input()) C = sorted([int(x) for x in input().split()], reverse=True) P = sum(C) ans = 0 for i, c in enumerate(C): if c <= P//10: ans = (len(C) - i)*30 break print(ans)