using System; using System.Linq; class A { 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 = Hadamard.Convolution(c[i], c[i]); r -= c2[x..(y + 1)].Sum(); r = MInt(r); } Console.WriteLine(r); } const long M = 998244353; static long MInt(long x) => (x %= M) < 0 ? x + M : x; static T[][] NewArray2(int n1, int n2, T v = default) => Array.ConvertAll(new bool[n1], _ => Array.ConvertAll(new bool[n2], __ => v)); 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); } } } } public static class Hadamard { const long M = 998244353; static long MInt(long x) => (x %= M) < 0 ? x + M : x; static long MPow(long b, long i) { long r = 1; for (; i != 0; b = b * b % M, i >>= 1) if ((i & 1) != 0) r = r * b % M; return r; } static long MInv(long x) => MPow(x, M - 2); static void FwtInternal(long[] c) { 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]; c[j] = MInt(x + y); c[j | i] = MInt(x - y); } } // n: Power of 2 // XOR public static long[] Fwt(long[] c, bool inverse = false) { var n = c.Length; var nInv = MInv(n); var r = new long[n]; c.CopyTo(r, 0); FwtInternal(r); if (inverse) for (int i = 0; i < n; ++i) r[i] = r[i] * nInv % M; return r; } public static long[] Convolution(long[] a, long[] b) { var fa = Fwt(a); var fb = Fwt(b); for (int i = 0; i < a.Length; ++i) fa[i] = fa[i] * fb[i] % M; return Fwt(fa, true); } }