#include template class ModInt { private: long long number; public: constexpr ModInt(const ModInt& x) : number(x.number) {} constexpr ModInt(const long long number = 0) : number(number) { if (number < 0 || number >= mod) this->number %= mod; if (this->number < 0) this->number += mod; } constexpr long long get() const { return number; } constexpr ModInt& operator=(const ModInt& rhs) & { number = rhs.number; return *this; } constexpr ModInt operator+() const { return ModInt(*this); } constexpr ModInt operator-() const { return ModInt(mod - number); } constexpr ModInt& operator+=(const ModInt& rhs) { number += rhs.number; if (number >= mod) number -= mod; return *this; } constexpr ModInt& operator-=(const ModInt& rhs) { number -= rhs.number; if (number < 0) number += mod; return *this; } constexpr ModInt& operator*=(const ModInt& rhs) { number *= rhs.number; if (number >= mod) number %= mod; return *this; } constexpr ModInt& operator/=(const ModInt& rhs) { (*this) *= rhs.inverse(); return *this; } constexpr ModInt inverse() const { long long a = number, m = mod, u = 1, v = 0; while (m) { long long t = a / m; a -= t * m; u -= t * v; a ^= m; m ^= a; a ^= m; u ^= v; v ^= u; u ^= v; } return ModInt(u); } constexpr ModInt& operator++() { return *this += 1; } constexpr ModInt& operator--() { return *this -= 1; } constexpr ModInt operator++(int) { ModInt ret = *this; ++(*this); return ret; } constexpr ModInt operator--(int) { ModInt ret = *this; --(*this); return ret; } constexpr ModInt operator+(const ModInt& rhs) const { return ModInt(*this) += rhs; } constexpr ModInt operator-(const ModInt& rhs) const { return ModInt(*this) -= rhs; } constexpr ModInt operator*(const ModInt& rhs) const { return ModInt(*this) *= rhs; } constexpr ModInt operator/(const ModInt& rhs) const { return ModInt(*this) /= rhs; } constexpr ModInt operator^(const long long& rhs) const { long long b = number, e = rhs, y = 1, m = mod; bool inv = e < 0; if (inv) e = -e; while (e) { if (e & 1) (y *= b) %= m; (b *= b) %= m; e >>= 1; } return (inv ? ModInt(y).inverse() : ModInt(y)); } }; template std::istream& operator>>(std::istream& is, ModInt& x) { long long in; is >> in; x = in; return is; } template std::ostream& operator<<(std::ostream& os, const ModInt& x) { os << x.get(); return os; } constexpr int MOD = 998244353; constexpr int LEN = 30; using namespace std; using mint = ModInt; void f(int l, int r, int k, vector& c, const vector& a) { if (l == r) return; if (k < 0) return; if (((a[l] >> k) & 1) == ((a[r - 1] >> k) & 1)) { f(l, r, k - 1, c, a); return; } c[k] |= 1; int m = l; for (; m < r; m++) { if ((a[m] >> k) & 1) break; } f(l, m, k - 1, c, a); f(m, r, k - 1, c, a); } int main() { int N; cin >> N; vector A(N, 0); for (int i = 0; i < N; i++) { cin >> A[i]; } sort(A.begin(), A.end()); vector c(LEN, 0); f(0, N, LEN - 1, c, A); mint ans = 1; for (int k = 0; k < LEN; k++) { ans *= c[k] + 1; } cout << ans << endl; return 0; }