#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

const int maxn = 305, mod = (int) 1e9 + 7;
int n;
int c[maxn][maxn];
int p2[maxn * maxn];
int bas[maxn][maxn];
int cnt[maxn][maxn];

void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

int mul(int a, int b) {
  return (long long) a * b % mod;
}

pair<int, int> gcd(int a, int b) {
  if (!b) {
    return make_pair(1, 0);
  }
  pair<int, int> p = gcd(b, a % b);
  return make_pair(p.second, p.first - (a / b) * p.second);
}

int inv(int x) {
  int res = gcd(x, mod).first;
  if (res < 0) {
    res += mod;
  }
  return res;
}

void precalc() {
  p2[0] = 1;
  for (int i = 1; i < maxn * maxn; i++) {
    p2[i] = mul(p2[i - 1], 2);
  }
  for (int n = 0; n < maxn; n++) {
    bas[n][0] = 1;
    for (int k = 1; k <= n; k++) {
      int tomul = p2[n];
      add(tomul, mod - p2[k - 1]);
      bas[n][k] = mul(bas[n][k - 1], tomul);
    }
  }
  for (int n = 0; n < maxn; n++) {
    for (int k = 0; k < maxn; k++) {
      if (k > n) {
        cnt[n][k] = 0;
        continue;
      }
      if (k == 0) {
        cnt[n][k] = 1;
        continue;
      }
      cnt[n][k] = mul(cnt[n - 1][k], p2[k]);
      int tomul = p2[k];
      add(tomul, mod - 1);
      add(cnt[n][k], mul(cnt[n - 1][k - 1], mul(tomul, p2[k - 1])));
    }
  }
}

int read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &c[i][j]);
    }
  }
  return true;
}

int getRank() {
  for (int i = 0; i < n; i++) {
    int x = -1, y = -1;
    for (int j = i; j < n; j++) {
      for (int k = i; k < n; k++) {
        if (c[j][k]) {
          x = j;
          y = k;
        }
      }
    }
    if (x == -1) {
      return i;
    }
    for (int j = i; j < n; j++) {
      swap(c[i][j], c[x][j]);
    }
    for (int j = i; j < n; j++) {
      swap(c[j][i], c[j][y]);
    }
    for (int j = i + 1; j < n; j++) {
      if (!c[j][i]) {
        continue;
      }
      for (int k = i; k < n; k++) {
        c[j][k] ^= c[i][k];
      }
    }
    for (int j = i + 1; j < n; j++) {
      c[i][j] = 0;
    }
  }
  return n;
}

void solve() {
  int k = getRank();
  eprintf("k = %d\n", k);
  int res = 0;
  for (int l = 0; l <= n - k; l++) {
    int cur = cnt[n - k][l];
    cur = mul(mul(cur, mul(bas[n][k + l], inv(bas[l][l]))), p2[n * (n - k - l)]);
    add(res, cur);
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef LOCAL
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 1664