#include <bits/stdc++.h>
using namespace std;
int64_t a[1 << 14][14];
char b[14][14];
vector<int> cb[20];
int64_t answ[1 << 15];
int n;
void dyn(int v, int gb) {
  if (v == n - 1) {
    for (int j = 0; j < n; j++) answ[gb] += a[(1 << n) - 1][j];
    return;
  }
  for (int m = 0; m < 2; m++) {
    for (auto x : cb[v + 2]) {
      for (int k = 0; k < n; k++) {
        if (x & (1 << k)) {
          int64_t sum = 0;
          int y = x - (1 << k);
          for (int k2 = 0; k2 < n; k2++) {
            if (y & (1 << k2)) {
              if (b[k2][k] == m) sum += a[y][k2];
            }
          }
          a[x][k] = sum;
        }
      }
    }
    dyn(v + 1, gb + (m << v));
  }
}
int main() {
  scanf("%i", &n);
  for (int i = 0; i < n; i++) {
    char s[20];
    scanf("%s", s);
    for (int j = 0; j < n; j++) {
      b[i][j] = s[j] & 1;
    }
  }
  for (int i = 1; i < (1 << n); i++) {
    int cnt = 0;
    for (int j = 0; j < n; j++) {
      if ((i >> j) & 1) cnt++;
    }
    cb[cnt].push_back(i);
  }
  for (int j = 0; j < n; j++) {
    a[1 << j][j] = 1;
  }
  dyn(0, 0);
  for (int i = 0; i < (1 << (n - 1)); i++) {
    printf("%lld ", answ[i]);
  }
}
