#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 998244353;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

const int N = 4010;
ll pow2[4020];

vi bxor(const vi& a, const vi& b) {
	vi res(N, 0);
	rep(i, 0, N) res[i] = (a[i] ^ b[i]);
	return res;
}

int fbit(const vi& a) { //fbit(0101) = 3
	rer(i, N, 0) {
		if(a[i] == 1) return i + 1;
	}
	return 0;
}

vi shift(const vi& a, int k) {
	vi res(N, 0);
	int fa = fbit(a);
	assert(fa + k <= N);
	rep(i, 0, fa) {
		res[i + k] = a[i];
	}
	return res;
}

bool is_zero(const vi& a) {
	rep(i, 0, N) {
		if(a[i]) return false;
	}
	return true;
}

vi gcd(const vi& a, const vi& b) {
	if(is_zero(b)) return a;
	vi c = a;
	while(true) {
		int fc = fbit(c), fb = fbit(b);
		if(fc < fb) break;
		int diff = fc - fb;
		c = bxor(c, shift(b, diff));
	}
	return gcd(b, c);
}

vi stobit(const string& str) {
	vector<int> res(N, 0);
	int n = sz(str);
	rep(i, 0, n) {
		res[n - i - 1] = str[i] - '0';
	}
	return res;
}

int M;
vi X;
vi B[10];

void solve() {
	string str;
	cin >> M >> str;
	pow2[0] = 1;
	rep(i, 1, 4010) pow2[i] = pow2[i - 1] * 2 % mod;
	X = stobit(str);
	rep(i, 0, M) {
		cin >> str;
		B[i] = stobit(str);
	}
	vi g = B[0];
	rep(i, 0, M - 1) g = gcd(g, B[i + 1]);
	int a = fbit(X), b = fbit(g);
	vi c(N, 0);
	ll res = 0;
	rep(i, 0, (a - b + 1)) {
		if(X[a - i - 1] == 1) {
			ADD(res, pow2[a - b - i]);
			if(c[a - i - 1] == 0) c = bxor(c, shift(g, (a - b - i)));
		}
		if(X[a - i - 1] == 0 && c[a - i - 1] == 1) {
			c = bxor(c, shift(g, (a - b - i)));
		}
	}
	rer(i, N, 0) {
		if(X[i] == 0 && c[i] == 1) {
			cout << res << "\n";
			return;
		}
		else if(X[i] == 1 && c[i] == 0) {
			cout << (res + 1) % mod << "\n";
			return;
		}
	}
	cout << (res + 1) % mod << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 32896