#include <bits/stdc++.h>
using namespace std;
vector<vector<vector<long long>>> dp;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> g(n, vector<int>(n));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      char c;
      cin >> c;
      g[i][j] = (c == '1');
    }
  }
  dp.resize(1 << n, vector<vector<long long>>(n, vector<long long>()));
  for (int i = 0; i < n; ++i) {
    dp[1 << i][i].push_back(1);
  }
  for (int i = 1; i < (1 << n); ++i) {
    int b = __builtin_popcount(i) - 1;
    if (!b) continue;
    for (int j = 0; j < n; ++j) {
      if (!((i >> j) & 1)) continue;
      dp[i][j].resize(1 << b, 0);
      int mask = i ^ (1 << j);
      for (int k = 0; k < n; ++k) {
        if (!((mask >> k) & 1)) continue;
        for (int s = 0; s < (1 << (b - 1)); ++s) {
          dp[i][j][(g[j][k] << (b - 1)) ^ s] += dp[mask][k][s];
        }
      }
    }
  }
  int all = (1 << n) - 1;
  for (int i = 0; i < (1 << (n - 1)); ++i) {
    long long ans = 0;
    for (int j = 0; j < n; ++j) {
      ans += dp[all][j][i];
    }
    cout << ans << " ";
  }
  cout << '\n';
}
