#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 2e18;
const int N = 16;
long long cnt[1 << N];
bool g[N][N];
int n;
const int HALF = 7;
long long frc[N][1 << HALF], bac[N][1 << HALF];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (int j = 0; j < n; ++j) {
      g[i][j] = (s[j] - '0');
    }
  }
  int half = n / 2, sec = n - half;
  vector<int> masks;
  for (int i = 0; i < (1 << n); ++i) {
    if (__builtin_popcount(i) == half) masks.push_back(i);
  }
  memset(cnt, 0, sizeof cnt);
  for (int mask : masks) {
    memset(frc, 0, sizeof frc);
    memset(bac, 0, sizeof bac);
    vector<int> fr, ba;
    for (int i = 0; i < n; ++i) {
      if (mask & (1 << i)) {
        fr.push_back(i);
      } else {
        ba.push_back(i);
      }
    }
    do {
      int cur = 0;
      for (int i = 1; i < half; ++i) {
        if (g[fr[i - 1]][fr[i]])
          cur = ((cur << 1) | 1);
        else
          cur = ((cur << 1) | 0);
      }
      frc[fr.back()][cur]++;
    } while (next_permutation((fr).begin(), (fr).end()));
    do {
      int cur = 0;
      for (int i = 1; i < sec; ++i) {
        if (g[ba[i - 1]][ba[i]])
          cur = ((cur << 1) | 1);
        else
          cur = ((cur << 1) | 0);
      }
      bac[ba.front()][cur]++;
    } while (next_permutation((ba).begin(), (ba).end()));
    for (int i = 0; i < half; ++i) {
      for (int icur = 0; icur < (1 << (half - 1)); ++icur) {
        for (int j = 0; j < sec; ++j) {
          int tfro = (icur << 1);
          if (g[fr[i]][ba[j]]) tfro |= 1;
          tfro = (tfro << (sec - 1));
          for (int jcur = 0; jcur < (1 << (sec - 1)); ++jcur) {
            cnt[tfro | jcur] += frc[fr[i]][icur] * bac[ba[j]][jcur];
          }
        }
      }
    }
  }
  for (int i = 0; i < (1 << (n - 1)); ++i) {
    cout << cnt[i] << " ";
  }
  cout << "\n";
  return 0;
}
