#include <bits/stdc++.h>
using namespace std;
const int N = 2012;
int n, ans1 = 0, ans2 = 0, u, v, t, i, j, k, x, y;
int s[N][N], f[N][N];
double d1, d2, d, pi = acos(-1.0);
void dfs(int x, int y) {
  if (!s[x][y]) return;
  s[x][y] = 0, t++;
  if (x > u || (x == u && y > v)) u = x, v = y;
  dfs(x - 1, y), dfs(x + 1, y), dfs(x, y - 1), dfs(x, y + 1);
}
int main() {
  cin >> n;
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= n; ++j) scanf("%d", f[i] + j);
  for (i = 1; i <= n - 4; ++i)
    for (j = 1; j <= n - 4; ++j) {
      k = 0;
      for (x = i; x <= i + 4; ++x)
        for (y = j; y <= j + 4; ++y) k += f[x][y];
      if (k >= 15) s[i][j] = 1;
    }
  for (i = 1; i <= n - 4; ++i)
    for (j = 1; j <= n - 4; ++j) {
      if (!s[i][j]) continue;
      u = i, v = j, t = 0;
      dfs(i, j);
      if ((d = sqrt((u - i) * (u - i) + (v - j) * (v - j))) < 10) continue;
      d1 = fabs(d * d * 0.25 * pi - t);
      d2 = fabs(d * d * 0.5 - t);
      if (d1 < d2)
        ans1++;
      else
        ans2++;
    }
  cout << ans1 << ' ' << ans2 << endl;
  return 0;
}
