#include <bits/stdc++.h>
using namespace std;
long long n, l, r, v[15][15], cnt[(1 << 14) + 1];
vector<long long> dp[(1 << 14)][15];
int main() {
  cin >> n;
  for (long long i = 0; i < n; i += 1) {
    for (long long j = 0; j < n; j += 1) {
      char a;
      cin >> a;
      v[i][j] = a - '0';
    }
  }
  for (long long i = 1; i < (1 << n); i += 1) {
    cnt[i] = cnt[i >> 1] + (i & 1);
  }
  for (long long i = 1; i < (1 << n); i += 1) {
    for (long long j = 0; j < n; j += 1) {
      if (!(i & (1 << j))) {
        continue;
      }
      dp[i][j].resize(1 << cnt[i] - 1);
    }
  }
  for (long long i = 0; i < n; i += 1) {
    dp[(1 << i)][i][0] = 1;
  }
  for (long long i = 1; i < (1 << n) - 1; i += 1) {
    for (long long v1 = 0; v1 < n; v1 += 1) {
      if (!(i & (1 << v1))) {
        continue;
      }
      for (long long j = 0; j < (1 << cnt[i] - 1); j += 1) {
        if (!dp[i][v1][j]) {
          continue;
        }
        for (long long v2 = 0; v2 < n; v2 += 1) {
          if (i & (1 << v2)) {
            continue;
          }
          dp[i | (1 << v2)][v2][j | (v[v1][v2] << cnt[i] - 1)] += dp[i][v1][j];
        }
      }
    }
  }
  for (long long i = 0; i < (1 << n - 1); i += 1) {
    long long ans = 0;
    for (long long j = 0; j < n; j += 1) {
      ans += dp[(1 << n) - 1][j][i];
    }
    cout << ans << " ";
  }
  cout << endl;
}
