from collections import defaultdict MOD = 998244353 N,M,K = list(map(int,input().split())) A = list(map(int,input().split())) A.sort() now = defaultdict(int) for i in A: now[i] += 1 for i in range(M-1): next = defaultdict(int) key = list(now.keys()) l,r = 0,0 S = 0 for j in key: while(r < len(key) and j-K <= key[r] <= j+K): S += now[key[r]] S %= MOD r += 1 while(l < len(key) and key[l] < j-K): S -= now[key[l]] S %= MOD l += 1 next[j] += S now,next = next,now print(sum(now.values()) % MOD)