import bisect MOD = 998244353 # 1. 入力の受け取り N, M, K = map(int, input().split()) A = list(map(int, input().split())) # 2. 二分探索の前計算 A.sort() D = [] for i in range(N): mae = bisect.bisect_left(A, A[i] - K) ato = bisect.bisect_left(A, A[i] + K + 1) - 1 D.append((mae, ato + 1)) # 1-indexed 用に +1 # 3. DP dp1 = [0] * (N + 1) dp2 = [0] * (N + 1) DP1 = [0] * (N + 1) DP2 = [0] * (N + 1) for i in range(M): for j in range(1, N + 1): if i == 0: dp1[j] = 1 elif i % 2 == 0: mae, ato = D[j - 1] dp1[j] = (DP2[ato] - DP2[mae] + MOD) % MOD else: mae, ato = D[j - 1] dp2[j] = (DP1[ato] - DP1[mae] + MOD) % MOD for j in range(1, N + 1): if i % 2 == 0: DP1[j] = (DP1[j - 1] + dp1[j]) % MOD else: DP2[j] = (DP2[j - 1] + dp2[j]) % MOD # 4. 答えの出力 if M % 2 == 0: print(DP2[N] % MOD) else: print(DP1[N] % MOD)