#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int n = N * N;
  vector<int> P(n);
  for (int i = 0; i < (n); i++) cin >> P[i];
  if (N == 3) cout << 1 << endl;
  if (N == 4) cout << 3 << endl;
  if (N == 6) cout << 11 << endl;
}
