#include <bits/stdc++.h>
using namespace std;
const int N = 16;
char e[N][N];
int n, ct[N][64], ctt[N][128];
bool vis[N];
long long ans[1 << 14 | 1];
void dfs(int u, int k) {
  if (u < k) return;
  if (k == 0) {
    static int p[N];
    int t = 0;
    for (int i = 1; i <= n; ++i)
      if (vis[i]) p[++t] = i;
    do {
      int S = 0;
      for (int i = 1; i < t; ++i) S = S << 1 | (e[p[i]][p[i + 1]]);
      ++ct[p[t]][S];
    } while (next_permutation(p + 1, p + t + 1));
    t = 0;
    for (int i = 1; i <= n; ++i)
      if (!vis[i]) p[++t] = i;
    do {
      int S = 0;
      for (int i = 1; i < t; ++i) S = S << 1 | (e[p[i]][p[i + 1]]);
      for (int i = 1; i <= n; ++i)
        if (vis[i]) {
          int T = S | (e[i][p[1]]) << (t - 1);
          ++ctt[i][T];
        }
    } while (next_permutation(p + 1, p + t + 1));
    for (int i = 1; i <= n; ++i)
      if (vis[i]) {
        for (int j = 0; j < 64; ++j)
          if (int x = ct[i][j])
            for (int k = 0; k < 128; ++k)
              ans[j << t | k] += (long long)x * ctt[i][k];
        memset(ct[i], 0, sizeof *ct);
        memset(ctt[i], 0, sizeof *ctt);
      }
    return;
  }
  dfs(u - 1, k);
  vis[u] = 1;
  dfs(u - 1, k - 1);
  vis[u] = 0;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> (e[i] + 1);
    for (int j = 1; j <= n; ++j) e[i][j] -= '0';
  }
  if (n < 10) {
    int p[N];
    for (int i = 1; i <= n; ++i) p[i] = i;
    do {
      int S = 0;
      for (int i = 1; i < n; ++i) S = S << 1 | (e[p[i]][p[i + 1]]);
      ++ans[S];
    } while (next_permutation(p + 1, p + n + 1));
    for (int i = 0; i < 1 << (n - 1); ++i) cout << ans[i] << ' ';
  } else {
    dfs(n, 7);
    for (int i = 0; i < 1 << (n - 1); ++i) cout << ans[i] << ' ';
  }
  return 0;
}
