#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 998244353LL;
vector<int> gcd(vector<int> A, vector<int> B) {
	if (B[0] == 0) {
		return A;
	}
	int N = A.size(), M = B.size();
	for (int i = 0; i <= N - M; i++) {
		if (A[i] == 1) {
			for (int j = 0; j < M; j++) {
				A[i + j] ^= B[j];
			}
		}
	}
	vector<int> R;
	bool zero = 1;
	for (int i = 0; i < N; i++) {
		if (A[i]) zero = 0;
		if (!zero) R.push_back(A[i]);
	}
	if (zero) R.push_back(0);
	return gcd(B, R);
}
int main() {
	int N;
	cin >> N;
	string X;
	cin >> X;
	vector<int> x;
	for (int i = 0; i < X.size(); i++) x.push_back(X[i] - '0');
	vector<int> g(1, 0);
	for (int i = 0; i < N; i++) {
		string A;
		cin >> A;
		vector<int> a;
		for (int i = 0; i < A.size(); i++) a.push_back(A[i] - '0');
		g = gcd(g, a);
	}
	if (g.size() > x.size()) {
		cout << 0 << endl;
		return 0;
	}
	ll ans = 0;
	for (int i = 0; i <= x.size() - g.size(); i++) {
		(ans *= 2) %= MOD;
		(ans += x[i]) %= MOD;
	}
	vector<int> y(x.size(), 0);
	for (int i = 0; i <= x.size() - g.size(); i++) {
		if (y[i] != x[i]) {
			for (int j = 0; j < g.size(); j++) y[i + j] ^= g[j];
		}
	}
	bool ok = 1;
	for (int i = x.size() - g.size() + 1; i < x.size(); i++) {
		if (y[i] < x[i]) break;
		if (y[i] > x[i]) {
			ok = 0;
			break;
		}
	}
	if (ok) (ans += 1) %= MOD;
	cout << ans << endl;
}