// weird "subset xor" convolution
// in O(MAX_VAL log^2 MAX_VAL)
// please let there be simpler solution pls pls
#include <bits/stdc++.h>
using namespace std;

const int kMaxLog = 17; // 2^17 > 100,000
const int MOD = 998244353;

int inve[(1 << kMaxLog) + 5];

int modPow(int x, int po) {
    int ret = 1;
    while (po) {
        if (po & 1) ret = 1ll * ret * x % MOD;
        x = 1ll * x * x % MOD;
        po >>= 1;
    }
    return ret;
}

// FWHT from KACTL
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void FST(vector<int>& a, bool inv) {
	for (int n = sz(a), step = 1; step < n; step *= 2) {
		for (int i = 0; i < n; i += 2 * step) rep(j,i,i+step) {
			int &u = a[j], &v = a[j + step]; tie(u, v) =
				// inv ? pii(v - u, u) : pii(v, u + v); // AND
				// inv ? pii(v, u - v) : pii(u + v, u); // OR /// include-line
				pii(u + v, u - v);                   // XOR /// include-line
                if (u < 0) u += MOD; if (u >= MOD) u -= MOD;
                if (v < 0) v += MOD; if (v >= MOD) v -= MOD;
		}
	}
	// if (inv) for (int& x : a) x /= sz(a); // XOR only /// include-line
    if (inv) for (int &x : a) x = 1ll * x * inve[sz(a)] % MOD;
}
vi conv(vi a, vi b) {
	FST(a, 0); FST(b, 0);
	rep(i,0,sz(a)) a[i] = 1ll * a[i] * b[i] % MOD;
	FST(a, 1);
    return a;
}
// end KACTL copy

int cntr[1 << kMaxLog];
int n;

void init() {
    for (int i = 1 ; i <= (1 << kMaxLog) ; i *= 2) {
        inve[i] = modPow(i, MOD-2);
    }
}

pair<vector<int>, vector<int>> rec(int l, int r) {
    if (l+1 == r) {
        // (3)
        if (l == 0) return {{1 + 2*cntr[l]}, {}};
        return {{1}, {2 * cntr[l]}};
    }

    int m = (l + r) / 2;
    auto [lowerL, upperL] = rec(l, m);
    auto [lowerR, upperR] = rec(m, r);

    // (1) by (2) and (3), upperL is guaranteed to be empty here. fill with 0s
    if (l == 0) upperL.resize(lowerL.size(), 0);

    // IMPORTANT: this is the main idea of this solution
    // 
    // we can show that the span of [l...r) from all <l, r> that can be reached
    // by this recursion from rec(0, 2^K)
    // will be [0, r-l) and [l, r). also, note that r-l must be 2^x for some integer x
    // 
    // notice that except when l = 0 (in which the two ranges collapse into one), 
    // there will be "gap" between those ranges
    // and normally, to do FWHT or some of that convolution thing, we have to
    // use the maximum value as our polynomial size
    // 
    // HOWEVER, observe that if we divide the convolution into these 4 parts,
    // we can show that the result of each convolution will fall entirely in
    // one of the two ranges above. thus, even if our max val (r-1) is huge,
    // we can do convolution in O((r-l) log (r-l)). the rest is just determining
    // which range they fall into. they also have a nice property which lets us easily
    // determine the overall xor convolution result
    // 
    // as I mentioned above, l=0 is a bit special. look for (1), (2), and (3)
    // to see some special handling
    // 
    // I suggest to try see what happen in rec(0, 2), rec(2, 4), and rec(0, 4)
    // to have a better understanding of what is going on
    vector<int> convLower1 = conv(lowerL, lowerR);
    vector<int> convLower2 = conv(upperL, upperR);
    vector<int> convUpper1 = conv(upperL, lowerR);
    vector<int> convUpper2 = conv(lowerL, upperR);

    vector<int> retLower, retUpper;

    // (2) no "gap", just put everything into the lower half
    if (l == 0) {
        for (int i = 0 ; i < convLower1.size() ; i++) {
            int val = (convLower1[i] + convLower2[i]) % MOD;
            retLower.push_back(val);
        }
        for (int i = 0 ; i < convUpper1.size() ; i++) {
            int val = (convUpper1[i] + convUpper2[i]) % MOD;
            retLower.push_back(val);
        }
    } else {
        // there is "gap", in this case it is guaranteed that we can split based on the gap
        retLower = convLower1;
        retLower.insert(retLower.end(), convLower2.begin(), convLower2.end());
        retUpper = convUpper1;
        retUpper.insert(retUpper.end(), convUpper2.begin(), convUpper2.end());
    }

    return {retLower, retUpper};
}

void read() {
    scanf("%d", &n);
    for (int i = 1 ; i <= n ; i++) {
        int x; scanf("%d", &x);
        cntr[x] = 1;
    }
}

int work() {
    auto [a, _] = rec(0, 1 << kMaxLog);
    int ret = a[0];
    return ret;
}

int main() {
    init();
    read();
    int ret = work();
    printf("%d\n", ret);
    return 0;
}
