N,A,B,C = map(int, input().split())
bamboos = [int(input()) for _ in range(N)]

targets = [A,B,C]
bamboos.sort(reverse=True)
targets.sort(reverse=True)

for target in targets:
    if target in bamboos:
        targets.remove(target)
        bamboos.remove(target)

if not len(targets):
  print(0)