n,a,b,c = [int(i) for i in input().split(' ')]
cba = [c,b,a]
banboo = []
for i in range(n):
  banboo.append(int(input()))
banboo.sort(reverse=True)

used = [False for i in range(n)]
answer=0;
for x in cba:
  if(banboo.count(x)>0):
    banboo.remove(x)
  else:
    for b in banboo:
      pass

print(answer)