#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7, INF = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
long long inv(long long first) {
  return first <= 1 ? 1 : inv(P % first) * (P - P / first) % P;
}
inline int rd() {
  int first = 0;
  char p = getchar();
  while (p < '0' || p > '9') p = getchar();
  while (p >= '0' && p <= '9') first = first * 10 + p - '0', p = getchar();
  return first;
}
int n;
vector<long long> f[1 << 14][14];
char s[14][14];
long long ans[1 << 14];
int main() {
  scanf("%d", &n);
  for (int i = 0; i <= n - 1; ++i) scanf("%s", s[i]);
  int mx = (1 << n) - 1;
  for (int i = 0; i <= mx; ++i)
    for (int j = 0; j <= n - 1; ++j)
      if (i >> j & 1) f[i][j].resize(1 << __builtin_popcount(i) - 1);
  for (int i = 0; i <= n - 1; ++i) f[1 << i][i][0] = 1;
  for (int i = 1; i <= mx; ++i)
    for (int j = 0; j <= n - 1; ++j)
      if (i >> j & 1) {
        int m = f[i][j].size() - 1;
        for (int k = 0; k <= m; ++k) {
          for (int first = 0; first <= n - 1; ++first)
            if (i >> first & 1 ^ 1) {
              int nxt = k;
              if (s[j][first] == '1') nxt ^= m + 1;
              f[i ^ (1 << first)][first][nxt] += f[i][j][k];
            }
          if (i == mx) ans[k] += f[i][j][k];
        }
      }
  mx = (1 << n - 1) - 1;
  for (int i = 0; i <= mx; ++i) printf("%lld ", ans[i]);
  putchar(10);
}
