using System; using System.Linq; class A { const long M = 998244353; 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(); Array.Sort(a); k = a.Length; var c = NewArray2(1 << 10, 1 << 10); var countsByXor = 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]++; countsByXor[xor]++; }); var r = 0L; for (int i = 0; i < 1 << 10; i++) for (int j = 0; j < 1 << 10; j++) { if ((i ^ j) < x || y < (i ^ j)) continue; r += countsByXor[i] * countsByXor[j]; r %= M; for (int a0 = 0; a0 < 1 << 10; a0++) { r -= c[a0][i] * c[a0][j]; r = (r + M) % M; } } 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 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); } } } }