using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, k, x, y) = (c[0], (int)c[1], (int)c[2], (int)c[3]); var a = NList; if (n > 30 || y >= 1024 || a.Max() >= 1024) { WriteLine(0); return; } WriteLine(Basic((int)n, k, x, y, a.Select(ai => (int)ai).ToArray())); } static long Basic(int n, int k, int x, int y, int[] a) { var m = 1024; var dp = new long[k][]; for (var i = 0; i < k; ++i) { dp[i] = new long[m]; ++dp[i][a[i]]; } var mod = 998_244_353; for (var i = 1; i < n; ++i) { var sum = new long[m]; for (var j = 0; j < k; ++j) for (var v = 0; v < m; ++v) sum[v] = (sum[v] + dp[j][v]) % mod; var ndp = new long[k][]; for (var j = 0; j < k; ++j) { ndp[j] = new long[m]; for (var v = 0; v < m; ++v) { ndp[j][v ^ a[j]] = (ndp[j][v ^ a[j]] + sum[v] - dp[j][v]) % mod; } } dp = ndp; } var ans = 0L; for (var j = 0; j < k; ++j) for (var v = x; v <= y; ++v) ans = (ans + dp[j][v]) % mod; return ans; } }