N,A,B,C = map(int,input().split())
l =[]
MP = 0

for i in range(N):
    l.append(int(input()))
l.sort()
l = list(set(l))

if A in l:
    l.remove(A)
if B in l:
    l.remove(B)
if C in l:
    l.remove(C)

if not l:
    print(0)