#include <bits/stdc++.h>
using namespace std;
int N;
string S[18];
signed long long ret[1 << 17];
int rev[1 << 18];
unordered_map<int, int> cnt[1 << 14][14];
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N;
  for (i = 0; i < (N); i++) cin >> S[i];
  for (i = 0; i < (N); i++) cnt[1 << i][i][0] = 1;
  for (int mask = 0; mask < 1 << N; mask++) {
    int nb = __builtin_popcount(mask);
    if (nb >= 7) continue;
    for (i = 0; i < (N); i++) {
      for (auto& m : cnt[mask][i]) {
        for (j = 0; j < (N); j++)
          if ((mask & (1 << j)) == 0) {
            int nm = m.first * 2;
            if (S[i][j] == '1') nm |= 1;
            cnt[mask | (1 << j)][j][nm] += m.second;
          }
      }
    }
  }
  int H = N / 2;
  for (i = 0; i < (1 << (H - 1)); i++) {
    x = 0;
    for (j = 0; j < (H - 1); j++)
      if (i & (1 << j)) x |= 1 << (H - 2 - j);
    rev[x] = i;
  }
  for (int mask = 0; mask < 1 << N; mask++) {
    int nb = __builtin_popcount(mask);
    if (nb != H) continue;
    int smask = ((1 << N) - 1) ^ mask;
    for (i = 0; i < (N); i++)
      if (mask & (1 << i)) {
        for (j = 0; j < (N); j++)
          if (smask & (1 << j)) {
            for (auto& m1 : cnt[mask][i])
              for (auto& m2 : cnt[smask][j]) {
                int nmask = (m2.first << H) | ((S[i][j] == '1') << (H - 1)) |
                            rev[m1.first];
                ret[nmask] += 1LL * m1.second * m2.second;
              }
          }
      }
  }
  for (i = 0; i < (1 << (N - 1)); i++) cout << ret[i] << " ";
  cout << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
