#include <bits/stdc++.h>
using namespace std;
char s[20];
int a[20][20];
vector<long long> f[(1 << 15) + 1][15];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", s + 1);
    for (int j = 1; j <= n; ++j) {
      a[i][j] = s[j] - '0';
    }
  }
  for (int i = 0; i < (1 << n); ++i) {
    for (int j = 1; j <= n; ++j)
      if (i >> j - 1 & 1) {
        int k = __builtin_popcount(i);
        f[i][j].resize(1 << k - 1);
      }
  }
  for (int i = 1; i <= n; ++i) {
    f[1 << i - 1][i][0] = 1;
  }
  for (int i = 0; i < (1 << n) - 1; ++i) {
    for (int j = 1; j <= n; ++j)
      if (i >> j - 1 & 1) {
        int k = __builtin_popcount(i);
        for (int w = 0; w < (1 << k - 1); ++w) {
          for (int h = 1; h <= n; ++h)
            if (!(i >> h - 1 & 1)) {
              f[i ^ (1 << h - 1)][h][w << 1 | a[j][h]] += f[i][j][w];
            }
        }
      }
  }
  for (int w = 0; w < (1 << n - 1); ++w) {
    long long ans = 0;
    for (int j = 1; j <= n; ++j) {
      ans += f[(1 << n) - 1][j][w];
    }
    printf("%lld ", ans);
  }
}
