#include <bits/stdc++.h>
using namespace std;
int mask_list[15][1 << 14];
int mask_cnt[15];
int mask_ord[1 << 14];
int adj[15][15];
vector<vector<vector<array<long long, 14>>>> dp(15);
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (int j = 0; j < n; ++j) {
      adj[i][j] = s[j] - '0';
    }
  }
  for (int i = 0; i < (1 << n); ++i) {
    int x = __builtin_popcount(i);
    mask_ord[i] = mask_cnt[x];
    mask_list[x][mask_cnt[x]++] = i;
  }
  dp[1] = vector<vector<array<long long, 14>>>(
      1, vector<array<long long, 14>>(n, array<long long, 14>()));
  for (int i = 0; i < n; ++i) {
    dp[1][0][i][i] = 1;
  }
  for (int i = 2; i <= n; ++i) {
    dp[i] = vector<vector<array<long long, 14>>>(
        1 << (i - 1),
        vector<array<long long, 14>>(mask_cnt[i], array<long long, 14>()));
    for (int j = 0; j < (1 << (i - 2)); ++j) {
      for (int k = 0; k < mask_cnt[i - 1]; ++k) {
        for (int lst = 0; lst < n; ++lst) {
          int x = mask_list[i - 1][k];
          for (int z = 0; z < n; ++z) {
            if (!((x >> z) & 1)) {
              int y = x ^ (1 << z);
              int q = (j << 1) + adj[z][lst];
              dp[i][q][mask_ord[y]][z] += dp[i - 1][j][k][lst];
            }
          }
        }
      }
    }
  }
  for (int i = 0; i < (1 << (n - 1)); ++i) {
    long long t = 0;
    for (int x = 0; x < n; ++x) {
      t += dp[n][i][0][x];
    }
    cout << t << " ";
  }
  cout << endl;
  return 0;
}
