#include <bits/stdc++.h>
using namespace std;
const int N = 15;
char s[N][N];
int a[N][N];
inline void push(int v[], int f[], int p, int ok, int n) {
  do {
    int x = 0;
    for (int i = 1; i < n; i++) {
      x = x << 1 | a[v[i - 1]][v[i]];
    }
    if (!ok)
      x |= a[v[0]][p] << (n - 1);
    else
      x = x << 1 | a[v[n - 1]][p];
    f[x]++;
  } while (next_permutation(v, v + n));
}
int f[1 << 7], g[1 << 7];
int va[N], vb[N];
long long ans[1 << 14];
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) a[i][j] = (s[i][j] == '1');
  if (n == 2) {
    if (a[0][1]) {
      cout << 0 << ' ' << 2 << endl;
    } else {
      cout << 2 << ' ' << 0 << endl;
    }
    return 0;
  }
  int x = n / 2, y = n - x - 1;
  for (int p = 0; p < n; p++) {
    for (int i = 0; i < 1 << n; i++)
      if (__builtin_popcount(i) == x && ((i >> p) & 1) == 0) {
        int sza = 0, szb = 0;
        for (int j = 0; j < n; j++)
          if (j != p) {
            if (i >> j & 1)
              va[sza++] = j;
            else
              vb[szb++] = j;
          }
        push(va, f, p, 0, x), push(vb, g, p, 1, y);
        for (int i = 0; i < 1 << x; i++)
          for (int j = 0; j < 1 << y; j++) ans[j << x | i] += 1ll * f[i] * g[j];
        for (int i = 0; i < 1 << x; i++) f[i] = 0;
        for (int i = 0; i < 1 << y; i++) g[i] = 0;
      }
  }
  for (int i = 0; i < 1 << (n - 1); i++) {
    printf("%lld ", ans[i]);
  }
  printf("\n");
}
