#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 2000;
const int drX[] = {0, 0, 1, -1};
const int drY[] = {1, -1, 0, 0};
int n;
int a[MAXN + 10][MAXN + 10];
int s[MAXN + 10][MAXN + 10];
int fangAns, yuanAns;
void fun(int x, int y) {
  static pair<int, int> q[MAXN * MAXN + 10];
  int head = 0, tail = 0;
  q[0] = make_pair(x, y);
  int minX = INF, minY = INF, maxX = -INF, maxY = -INF;
  static int mostL[MAXN + 10], mostR[MAXN + 10];
  memset(mostL, '?', sizeof(mostL));
  memset(mostR, 128, sizeof(mostR));
  while (head <= tail) {
    pair<int, int> now = q[head++];
    mostL[now.first] = min(mostL[now.first], now.second);
    mostR[now.first] = max(mostR[now.first], now.second);
    minX = min(minX, now.first);
    maxX = max(maxX, now.first);
    minY = min(minY, now.second);
    maxY = max(maxY, now.second);
    for (int k = 0; k < 4; k++) {
      x = now.first + drX[k], y = now.second + drY[k];
      if (1 <= x && x <= n && 1 <= y && y <= n && a[x][y]) {
        q[++tail] = make_pair(x, y);
        a[x][y] = 0;
      }
    }
  }
  if (tail < 50) return;
  int midX = (minX + maxX) >> 1, midY = (minY + maxY) >> 1;
  int minDist = INF, maxDist = -INF;
  for (int i = minX; i <= maxX; i++) {
    int curDist =
        (i - midX) * (i - midX) + (mostL[i] - midY) * (mostL[i] - midY);
    minDist = min(minDist, curDist);
    maxDist = max(maxDist, curDist);
    curDist = (i - midX) * (i - midX) + (mostR[i] - midY) * (mostR[i] - midY);
    minDist = min(minDist, curDist);
    maxDist = max(maxDist, curDist);
  }
  if (maxDist / (double)minDist > 1.8)
    fangAns++;
  else
    yuanAns++;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      s[i][j] = a[i][j] + s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1];
  n = n - 7;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      a[i][j] = s[i + 7][j + 7] + s[i][j] - s[i + 7][j] - s[i][j + 7] > 24;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (a[i][j]) fun(i, j);
  cout << yuanAns << endl << fangAns << endl;
  return 0;
}
