#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e9 + 5;
const long long MOD = (long long)1e9 + 7;
const int MAXN = 14;
int n, know[MAXN][MAXN], bcnt[1 << MAXN];
vector<long long> dp[1 << MAXN][MAXN];
int main() {
  cin >> n;
  int lim = 1 << n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      char ch;
      cin >> ch;
      know[i][j] = ch - '0';
    }
  }
  for (int i = 1; i < lim; i++) {
    bcnt[i] = bcnt[i >> 1] + (i & 1);
    for (int j = 0; j < n; j++) {
      if (i >> j & 1) {
        dp[i][j].resize(1 << (bcnt[i] - 1));
      }
    }
  }
  for (int i = 0; i < n; i++) {
    dp[1 << i][i][0] = 1;
  }
  for (int i = 1; i < lim; i++) {
    for (int j = 0; j < n; j++) {
      if (~i >> j & 1) continue;
      for (int k = 0; k < dp[i][j].size(); k++) {
        if (dp[i][j][k] == 0) continue;
        for (int put = 0; put < n; put++) {
          if (i >> put & 1) continue;
          dp[i | 1 << put][put][k | know[j][put] << (bcnt[i] - 1)] +=
              dp[i][j][k];
        }
      }
    }
  }
  for (int i = 0; i < (lim >> 1); i++) {
    long long ans = 0;
    for (int j = 0; j < n; j++) {
      ans += dp[lim - 1][j][i];
    }
    cout << ans << " \n"[i + 1 == (lim >> 1)];
  }
  return 0;
}
