#include <bits/stdc++.h>
using namespace std;
int n;
char a[15][15];
vector<long long int> dp[1 << 14][14];
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    dp[1 << i][i].push_back(1LL);
  }
  for (int i = 1; i < (1 << n); i++) {
    int p = __builtin_popcount(i);
    for (int j = 0; j < n; j++) {
      if (((i >> j) & 1) == 0) continue;
      for (int k = 0; k < n; k++) {
        if ((i >> k) & 1) continue;
        if (dp[i + (1 << k)][k].size() == 0) {
          dp[i + (1 << k)][k].resize((1 << p));
        }
        int t = 0;
        if (a[j][k] == '1') t = 1;
        for (int l = 0; l < dp[i][j].size(); l++) {
          dp[i + (1 << k)][k][t * (1 << (p - 1)) + l] += dp[i][j][l];
        }
      }
    }
  }
  for (int i = 0; i < (1 << (n - 1)); i++) {
    long long int res = 0;
    for (int j = 0; j < n; j++) {
      res += dp[(1 << n) - 1][j][i];
    }
    printf("%lld ", res);
  }
  printf("\n");
}
