using System; using System.Linq; class A { const long M = 998244353; const long MHalf = (M + 1) / 2; static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); static (int, int, int, int) Read4() { var a = Read(); return (a[0], a[1], a[2], a[3]); } static void Main() { var (n, k, x, y) = Read4(); var a = Read(); a = a.Distinct().ToArray(); k = a.Length; var c = NewArray2(1 << 10, 1 << 10); var xors = new long[1 << 10]; var rn1 = Enumerable.Range(0, n / 2 - 1).ToArray(); Power(a, n / 2, p => { if (rn1.Any(i => p[i] == p[i + 1])) return; var xor = p.Aggregate((x, y) => x ^ y); c[p[0]][xor]++; xors[xor]++; }); var r = 0L; for (int u = 0; u < 1 << 10; u++) for (int v = 0; v < 1 << 10; v++) { if ((u ^ v) < x || y < (u ^ v)) continue; r += xors[u] * xors[v]; r %= M; } for (int i = 0; i < 1 << 10; i++) { var c2 = (long[])c[i].Clone(); c2 = Convolution(c2, c[i]); r -= c2[x..(y + 1)].Sum(); r = MInt(r); } Console.WriteLine(r); } static T[][] NewArray2(int n1, int n2, T v = default) => Array.ConvertAll(new bool[n1], _ => Array.ConvertAll(new bool[n2], __ => v)); static long MInt(long x) => (x %= M) < 0 ? x + M : x; static void Power(T[] values, int r, Action action) { var n = values.Length; var p = new T[r]; if (r > 0) Dfs(0); else action(p); void Dfs(int i) { var i2 = i + 1; for (int j = 0; j < n; ++j) { p[i] = values[j]; if (i2 < r) Dfs(i2); else action(p); } } } static void Fwt(long[] c, bool inverse = false) { var n = c.Length; for (int i = 1; i < n; i <<= 1) { for (int j = 0; j < n; j++) { if ((j & i) != 0) continue; var x = c[j]; var y = c[j | i]; if (inverse) { c[j] = MInt((x + y) * MHalf); c[j | i] = MInt((x - y) * MHalf); } else { c[j] = MInt(x + y); c[j | i] = MInt(x - y); } } } } public static long[] Convolution(long[] a, long[] b) { Fwt(a); Fwt(b); for (int i = 0; i < a.Length; ++i) a[i] = a[i] * b[i] % M; Fwt(a, true); return a; } }