N = int(input().strip()) C = [int(i) for i in input().strip().split(' ')] print(sum([1 for i in C if (i - 1) * 10 // sum(C) == 0]) * 30)