#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005;
int n;
bool a[MAXN][MAXN];
bool u[MAXN][MAXN];
bool b[MAXN][MAXN];
int maX = -1, may = -1, mix = -1, miy = -1;
int stk[MAXN * MAXN][2], top = 0;
void dfs(int x, int y) {
  u[x][y] = true;
  top++;
  stk[top][0] = x;
  stk[top][1] = y;
  if (maX == -1 || x > maX) maX = x;
  if (may == -1 || y > may) may = y;
  if (mix == -1 || x < mix) mix = x;
  if (miy == -1 || y < miy) miy = y;
  if (b[x - 1][y] && !u[x - 1][y]) dfs(x - 1, y);
  if (b[x + 1][y] && !u[x + 1][y]) dfs(x + 1, y);
  if (b[x][y - 1] && !u[x][y - 1]) dfs(x, y - 1);
  if (b[x][y + 1] && !u[x][y + 1]) dfs(x, y + 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      int t;
      scanf("%d", &t);
      a[i][j] = t;
    }
  int T = 2;
  int m = n / T;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= m; j++) {
      int s = 0;
      for (int k = T * i - T + 1; k <= T * i; k++)
        for (int l = T * j - T + 1; l <= T * j; l++)
          if (a[k][l]) s++;
      if (s >= T * T / 2) b[i][j] = true;
    }
  n = m;
  int ans1 = 0, ans2 = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (!u[i][j] && b[i][j]) {
        maX = -1, may = -1, mix = -1, miy = -1;
        top = 0;
        dfs(i, j);
        double x = (maX + mix) / 2;
        double y = (may + miy) / 2;
        double r = 0;
        for (int k = 1; k <= top; k++) {
          if ((stk[k][0] - x) * (stk[k][0] - x) +
                  (stk[k][1] - y) * (stk[k][1] - y) >
              r)
            r = (stk[k][0] - x) * (stk[k][0] - x) +
                (stk[k][1] - y) * (stk[k][1] - y);
        }
        double rat = top / r;
        if (rat > 2.6)
          ans1++;
        else
          ans2++;
      }
  printf("%d %d\n", ans1, ans2);
  return 0;
}
