#include <cstdio>

int readint() {
	int res = 0;
	char c = getchar_unlocked();
	while ('0' <= c && c <= '9') {
		res = res * 10 + int(c - '0');
		c = getchar_unlocked();
	}
	return res;
}

int N, A[200000], tmp[200000], cnt[32800];
int main() {
	// step #1. input & radix sort
	N = readint();
	for (int i = 0; i < N; i++) {
		A[i] = readint();
		cnt[(A[i] & 32767) + 1] += 1;
	}
	for (int i = 0; i < 32768; i++) cnt[i + 1] += cnt[i];
	for (int i = 0; i < N; i++) tmp[cnt[A[i] & 32767]++] = A[i];
	for (int i = 0; i < 32769; i++) cnt[i] = 0;
	for (int i = 0; i < N; i++) cnt[(tmp[i] >> 15) + 1] += 1;
	for (int i = 0; i < 32768; i++) cnt[i + 1] += cnt[i];
	for (int i = 0; i < N; i++) A[cnt[tmp[i] >> 15]++] = tmp[i];
	// step #2. compute the answer
	int bit = 0;
	for (int i = 0; i < N - 1; i++) {
		if (A[i] != A[i + 1]) {
			bit |= 1 << __builtin_clz(A[i] ^ A[i + 1]);
		}
	}
	printf("%d\n", (1 << __builtin_popcount(bit)) % 998244353);
	return 0;
}