#include <bits/stdc++.h>
using namespace std;
char a[2020][2020];
int vfl[2020], hfl[2020];
int vfh[2020], hfh[2020];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%s", a[i]);
  memset(vfl, 0, sizeof(vfl));
  memset(hfl, 0, sizeof(hfl));
  memset(vfh, 0, sizeof(vfh));
  memset(hfh, 0, sizeof(hfh));
  int res = 0;
  for (int i = 0; i < n / 2; i++) {
    int x = n - 1 - i, y = i;
    if ((vfl[y] + hfl[x]) % 2 != a[x][y] - '0') {
      vfl[y]++;
      hfl[x]++;
      res++;
    }
    x = n - 2 - i, y = i;
    while (x > y) {
      if ((vfl[y] + hfl[x]) % 2 != a[x][y] - '0') {
        vfl[y]++;
        hfl[x]++;
        res++;
      }
      x--;
    }
    x = n - 1 - i, y = i + 1;
    while (x > y) {
      if ((vfl[y] + hfl[x]) % 2 != a[x][y] - '0') {
        vfl[y]++;
        hfl[x]++;
        res++;
      }
      y++;
    }
  }
  for (int i = 0; i < n / 2; i++) {
    int x = i, y = n - 1 - i;
    if ((vfh[y] + hfh[x]) % 2 != a[x][y] - '0') {
      vfh[y]++;
      hfh[x]++;
      res++;
    }
    x = i + 1, y = n - 1 - i;
    while (y > x) {
      if ((vfh[y] + hfh[x]) % 2 != a[x][y] - '0') {
        vfh[y]++;
        hfh[x]++;
        res++;
      }
      x++;
    }
    x = i, y = n - 2 - i;
    while (y > x) {
      if ((vfh[y] + hfh[x]) % 2 != a[x][y] - '0') {
        vfh[y]++;
        hfh[x]++;
        res++;
      }
      y--;
    }
  }
  for (int i = 0; i < n; i++) {
    int x = i, y = i;
    if ((vfl[y] + vfh[y] + hfl[x] + hfh[x]) % 2 != a[x][y] - '0') res++;
  }
  cout << res << endl;
  return 0;
}
