b,c,d,n,*a = map(int,open(0).read().split()) b,c,d = sorted([b,c,d]) from itertools import combinations a.sort() print(sum((b <= a[i] and c <= a[j] and d <= a[k])<