#include <bits/stdc++.h>
using namespace std;
void solve();
signed main() {
  srand(time(0));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(9);
  solve();
  return 0;
}
const long long MAXN = 1e5 + 10;
long long g[14][14];
long long n;
vector<long long> h[MAXN];
vector<long long> f[14][16500];
void solve() {
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < n; ++j) {
      char c;
      cin >> c;
      g[i][j] = c - '0';
    }
  }
  for (long long mask = 0; mask < (1 << 14); ++mask) {
    for (long long i = 0; i < 14; ++i) {
      if ((mask >> i) & 1) {
        h[mask].push_back(i);
      }
    }
  }
  vector<long long> p(15);
  p[0] = 1;
  for (long long i = 1; i < 15; ++i) {
    p[i] = p[i - 1] * 2;
  }
  for (long long v = 0; v < n; ++v) {
    f[v][p[v]].resize(1);
    f[v][p[v]][0] = 1;
  }
  for (long long mask_v = 1; mask_v < (1 << n); ++mask_v) {
    long long cnt = (long long)((h[mask_v]).size());
    if (cnt < 2) continue;
    for (long long v = 0; v < n; ++v) {
      f[v][mask_v].resize(p[cnt - 1]);
    }
    for (long long mask_t = 0; mask_t < (1 << (cnt - 1)); ++mask_t) {
      for (long long v = 0; v < n; ++v) {
        if (!((mask_v >> v) & 1)) continue;
        long long cur_mask = mask_v - p[v];
        long long cur_type = mask_t >> 1;
        for (auto u : h[cur_mask]) {
          if ((mask_t & 1) == g[v][u]) {
            f[v][mask_v][mask_t] += f[u][cur_mask][cur_type];
          }
        }
      }
    }
  }
  for (long long mask = 0; mask < (1 << (n - 1)); ++mask) {
    long long ans = 0;
    for (long long v = 0; v < n; ++v) {
      ans += f[v][(1 << n) - 1][mask];
    }
    cout << ans << " ";
  }
  cout << '\n';
}
