//#ifdef DEBUG
//#define _GLIBCXX_DEBUG
//#endif
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int mod = (int)1e9 + 7;
int sum(int a, int b) {
    int s = a + b;
    if (s >= mod) s -= mod;
    return s;
}
int mult(int a, int b) {
    return (1LL * a * b) % mod;
}
int pw(int a, int b) {
    if (b == 0) return 1;
    if (b & 1) return mult(a, pw(a, b - 1));
    int res = pw(a, b / 2);
    return mult(res, res);
}
int sub(int a, int b) {
    int s = a - b;
    if (s < 0) s += mod;
    return s;
}
const int maxN = 305;
typedef bitset < maxN > bs;
bs f[maxN];
int val[maxN][maxN];
int pw2[maxN];
int tot[maxN][maxN];
int ways[maxN][maxN];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    pw2[0] = 1;
    for (int i = 1; i <= n; i++) pw2[i] = mult(pw2[i - 1], 2);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            int c;
            cin >> c;
            f[i][j] = c;
        }
    }
    int rng = 0;
    vector<bool> used(n);
    for (int col = 0; col < n; col++) {
        int who = -1;
        for (int row = 0; row < n; row++) {
            if (f[row][col] && !used[row]) who = row;
        }
        if (who == -1) continue;
        used[who] = true;
        rng++;
        for (int row = 0; row < n; row++) {
            if (!used[row]) {
                if (f[row][col]) f[row] ^= f[who];
            }
        }
    }
    for (int i = n; i >= 0; i--) {
        val[i][0] = 1;
        for (int j = 1; j <= i; j++) {
            val[i][j] = val[i][j - 1];
            val[i][j] = mult(val[i][j], sub(pw2[i], pw2[j - 1]));
        }
    }
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            tot[i][j] = mult(val[i][j], pw(val[j][j], mod - 2));
        }
    }
    ways[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int rng = 0; rng <= n; rng++) {
            ways[i + 1][rng] = sum(ways[i + 1][rng], mult(ways[i][rng], pw2[rng]));
            if (rng + 1 <= n) ways[i + 1][rng + 1] = sum(ways[i + 1][rng + 1], 
                                                    mult(ways[i][rng], sub(pw2[n], pw2[rng])));
        }
    }
    /*int g = 0;
    for (int a = 0; a < (1 << (n * n)); a++) {
        for (int b = 0; b < (1 << (n * n)); b++) {
            bool ok = true;
            for (int x = 0; x < n; x++) {
                for (int y = 0; y < n; y++) {
                    int t = 0;
                    for (int z = 0; z < n; z++) {
                        if (a & (1 << (x * n + z))) {
                            if (b & (1 << (z * n + y))) {
                                t ^= 1;
                            }
                        }
                    }
                    if (t != f[x][y]) ok =false;
                }
            }
            if (ok) g++;
        }
    }*/
    int ans = 0;
    for (int our_rng = rng; our_rng <= n; our_rng++) {
        int coef = pw(2, n * (n - our_rng));
        coef = mult(coef, ways[n][our_rng]);
        coef = mult(coef, pw(tot[n][our_rng], mod - 2));
        coef = mult(coef, tot[n][our_rng]);
        coef = mult(coef, tot[our_rng][rng]);
        coef = mult(coef, pw(tot[n][rng], mod - 2));
        ans = sum(ans, coef);
    }
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 4732