N = int(input().strip()) C = [int(i) for i in input().strip().split(' ')] s = sum(C) CC = [i for i in C if i <= (s // 10)] print(str(len(CC) * 30))