#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("-ffloat-store")
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void aryanc403() {}
const int INF = 0xFFFFFFFFFFFFFFFL;
int seed;
mt19937 rng(seed = chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l = 0, int r = INF) {
  return uniform_int_distribution<int>(l, r)(rng);
}
class CMP {
 public:
  bool operator()(pair<int, int> a, pair<int, int> b) {
    return !(a.first < b.first || (a.first == b.first && a.second <= b.second));
  }
};
void add(map<int, int> &m, int x, int cnt = 1) {
  auto jt = m.find(x);
  if (jt == m.end())
    m.insert({x, cnt});
  else
    jt->second += cnt;
}
void del(map<int, int> &m, int x, int cnt = 1) {
  auto jt = m.find(x);
  if (jt->second <= cnt)
    m.erase(jt);
  else
    jt->second -= cnt;
}
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  return a.first < b.first || (a.first == b.first && a.second < b.second);
}
const int mod = 1000000007L;
const int N = 14L;
int T, n, i, j, k, in, cnt, l, r, u, v, x, y;
int m;
string s[N];
vector<long long int> dp[1LL << N][N];
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  {
    cin >> n;
    for (i = 0; i < (n); ++i) cin >> s[i];
    for (int i = 1; i < (1 << n); ++i)
      for (int j = 0; j < n; ++j)
        dp[i][j].resize((1 << (__builtin_popcount(i))) >> 1, 0);
    for (int j = 0; j < n; ++j) dp[1 << j][j][0] = 1;
    for (int used = 1; used < (1 << n); ++used) {
      const int len = __builtin_popcount(used) - 2;
      if (len == -1) continue;
      vector<int> c;
      for (int j = 0; j < n; ++j)
        if (used & (1 << j)) c.push_back(j);
      for (const auto &lst : c)
        for (const auto &k : c) {
          if (k == lst) continue;
          const int fl = (s[lst][k] - '0' ? (1 << len) : 0);
          for (int msk = 0; msk < (1 << len); ++msk)
            dp[used][lst][msk | fl] += dp[used ^ (1 << lst)][k][msk];
        }
    }
    for (int i = 0; 2 * i < (1 << n); ++i) {
      long long int ans = 0;
      for (int j = 0; j < n; ++j) ans += dp[(1 << n) - 1][j][i];
      cout << ans << "\n";
    }
  }
  aryanc403();
  return 0;
}
