import sys readline = sys.stdin.readline N, M, K = map(int, readline().split()) op, *A = readline().strip().split() A = [int(a) for a in A] A.sort(reverse = True) B = [int(readline()) for _ in range(N)] res = 0 for b in B: ok = -1 ng = M while abs(ok-ng)>1: med = (ok+ng)//2 if eval(f'{A[med]}{op}{b}') >= K: ok = med else: ng = med res += 1+ok print(res)