#include <bits/stdc++.h>
using namespace std;
template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& input) {
  for (auto const& i : input) {
    os << i << " ";
  }
  return os;
}
template <class T1, class T2>
std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& input) {
  os << "(" << input.first << ", " << input.second << ')';
  return os;
}
const int maxn = 14;
void pre() {}
vector<long long> dp[maxn][1 << maxn];
int n;
vector<string> s;
queue<pair<int, int> > Q;
inline void init_dp(int i, int mask) {
  if (int((dp[i][mask]).size())) return;
  int num = 0;
  for (int j = 0; j < int(n); ++j)
    if ((mask >> j) & 1) num++;
  dp[i][mask] = vector<long long>(1 << (n - 1 - num), 0);
  Q.push(make_pair(i, mask));
}
inline void extend(int i, int rest) {
  int num = 0;
  for (int j = 0; j < int(n); ++j)
    if ((rest >> j) & 1) num++;
  int k = n - 1 - num;
  for (int j = 0; j < int(n); ++j)
    if ((rest >> j) & 1) {
      int bit = s[i][j] - '0';
      init_dp(j, rest - (1 << j));
      for (int state = 0; state < int(1 << k); ++state) {
        dp[j][rest - (1 << j)][state + (bit << k)] += dp[i][rest][state];
      }
    }
}
void solve() {
  cin >> n;
  for (int i = 0; i < int(n); ++i) {
    string ss;
    cin >> ss;
    s.push_back(ss);
  }
  int rest = (1 << n) - 1;
  for (int i = 0; i < int(n); ++i) {
    init_dp(i, rest - (1 << i));
    dp[i][rest - (1 << i)][0] = 1;
  }
  while (!Q.empty()) {
    auto p = Q.front();
    Q.pop();
    extend(p.first, p.second);
  }
  for (int p = 0; p < int(1 << (n - 1)); ++p) {
    long long sum = 0;
    for (int i = 0; i < int(n); ++i) {
      sum += dp[i][0][p];
    }
    cout << sum << " ";
  }
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int cas = 1;
  pre();
  for (int ca = 0; ca < int(cas); ++ca) solve();
  return 0;
}
