#include <bits/stdc++.h>
using namespace std;
bool a[2001][2001], w[2001][2001];
int n, fi, fj, si, sj, dist, s, clr = 4;
inline bool val(int x, int y) { return (x > 0 && y > 0 && x < n && y < n); }
inline void clear(int x, int y) {
  s = 0;
  for (int i = 0; i < clr; i++)
    for (int j = 0; j < clr; j++)
      if (a[i + x][j + y]) s++;
  if (s <= clr)
    for (int i = 0; i < clr; i++)
      for (int j = 0; j < clr; j++) a[i + x][j + y] = 0;
}
void dfs(int x, int y) {
  w[x][y] = 1;
  s++;
  if (((x - fi) * (x - fi)) + ((y - fj) * (y - fj)) > dist)
    dist = ((x - fi) * (x - fi)) + ((y - fj) * (y - fj));
  if (val(x - 1, y) && a[x - 1][y] && !w[x - 1][y]) dfs(x - 1, y);
  if (val(x + 1, y) && a[x + 1][y] && !w[x + 1][y]) dfs(x + 1, y);
  if (val(x, y - 1) && a[x][y - 1] && !w[x][y - 1]) dfs(x, y - 1);
  if (val(x, y + 1) && a[x][y + 1] && !w[x][y + 1]) dfs(x, y + 1);
}
int main() {
  ios_base::sync_with_stdio(0);
  int i, j, x, as = 0, ac = 0;
  cin >> n;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++) cin >> a[i][j];
  for (i = 0; i < n; i += clr)
    for (j = 0; j < n; j += clr) clear(i, j);
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      if (!w[i][j] && a[i][j]) {
        dist = s = 0;
        fi = i, fj = j;
        dfs(i, j);
        if (dist < 200.0) {
          a[i][j] = 0;
          continue;
        }
        s *= 1.2;
        double d = sqrt(dist), sq = ((d / sqrt(2.0)) * (d / sqrt(2.0))),
               circ = ((d / 2.0) * (d / 2.0)) * M_PI;
        if (abs(s - sq) < abs(s - circ))
          as++;
        else
          ac++;
      }
  cout << ac << ' ' << as;
  return 0;
}
