n = int(input()) c = [int(x) for x in input().split()] th = sum(c) // 10 res = 0 for ci in c: if ci <= th: res += 30 print(res)