#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 4005;
const int MM = 998244353;

typedef bitset<MX> Integer;
void print(Integer P);

bool divide(Integer X, Integer Y, Integer &P, Integer &Q)
{
	Integer Z = X;
	P.reset();
	int high = MX-1;
	for(; high >= 0; high--) if(Y[high]) break;
	for(int i = MX-high-1; i >= 0; i--){
		if( X[i+high] ){
			X ^= Y<<i;
		}
		if( Z[i+high] ){
			Z[i+high] = 0;
			P[i] = 1;
		}
	}
	Q = X;
	print(Z);
	print(Q);
	for(int i = high-1; i >= 0; i--) if( Q[i] ) return Z[i];
	return true;
}

char buf[MX];

Integer gcd(Integer A, Integer B){
	Integer C, D;
	divide(A, B, C, D);
	if( D.none() ) return B;
	else return gcd(B, D);
}

Integer input(){
	Integer X; X.reset();
	scanf("%s", buf);
	int L = strlen(buf);
	for(int i = 0; buf[i]; i++) X[L-i-1] = buf[i]-'0';
	return X;
}

void print(Integer P){
//	for(int i = 0; i < 10; i++) printf("%d", !!P[i]); printf("\n");
}

int main()
{
	int N;
	Integer X, A[10];
	X.reset();
	scanf("%d", &N);
	X = input();
	for(int i = 1; i <= N; i++){
		A[i] = input();
		print(A[i]);
	}

	Integer G = A[1];
	for(int i = 2; i <= N; i++) G = gcd(G, A[i]);
	print(G);

	Integer tmp, t2;
	int ans = 0, flag = 0;
	flag = divide(X, G, tmp, t2);
	for(int i = MX-1; i >= 0; i--){
		ans = (ans * 2 + tmp[i]) % MM;
	}
	printf("%d\n", (ans+flag)%MM);
}
