%:pragma GCC optimize("Ofast", "inline", "-ffast-math")
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;
typedef long long lo;
template<typename tp> inline void read(tp &x) {
x = 0; char c = getchar(); int f = 0;
for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
if (f) x = -x;
}
namespace {
const int mo = 1e9 + 7;
inline int add(int x, int y) {
if ((x += y) >= mo) x -= mo;
return x;
}
inline int sub(int x, int y) {
if ((x -= y) < 0) x += mo;
return x;
}
inline int mul(int x, int y) {
return 1LL * x * y % mo;
}
inline void U(int &x, int y) {
x = add(x, y);
}
inline int power(int a, int k) {
int ans = 1;
for (; k; k >>= 1, a = mul(a, a))
if (k & 1) ans = mul(ans, a);
return ans;
}
}
const int N = 333;
int n, rank_c, c[N][N], dp[N][N];
bool visit[N];
bitset <N> d[N], l[N];
int main(void) {
read(n);
rep (i, n) rep (j, n) read(c[i][j]);
rep (j, n) rep (i, n) d[j][i] = c[i][j];
rep (j, n) {
for (int wei = n; wei >= 1; wei--)
if (d[j][wei] == 1) {
if (!visit[wei]) {
l[wei] = d[j];
visit[wei] = true;
++rank_c;
break;
}
d[j] ^= l[wei];
}
}
dp[0][0] = 1;
re0 (i, n + 1) re0 (j, n + 1) {
U(dp[i + 1][j], mul(power(2, j), dp[i][j]));
U(dp[i + 1][j + 1], mul(sub(power(2, n), power(2, j)), dp[i][j]));
}
int ans = 0;
re0 (i, n + 1) if (i >= rank_c)
U(ans, mul(dp[n][i], mul(power(2, n * (n - i)), dp[i][rank_c])));
cout << mul(power(dp[n][rank_c], mo - 2), ans) << "\n";
}