#include <bits/stdc++.h>
using namespace std;
char a[2100][2100];
int n, ans, r0[2100], c0[2100], r1[2100], c1[2100];
void nex(int &i, int &j) {
  i++;
  j++;
  if (j == n) {
    j = n - i - 1;
    i = 0;
  }
  if (i == n) {
    i = n - j - 1;
    j = 0;
  }
}
void work() {
  ans = 0;
  for (int i = 0; i < n; i++) scanf("%s", a[i]);
  memset(r0, 0, sizeof(r0));
  memset(c0, 0, sizeof(c0));
  memset(r1, 0, sizeof(r1));
  memset(c1, 0, sizeof(c1));
  for (int i = 0, j = n - 1; i != j; nex(i, j)) {
    int opt = r0[i] ^ c0[j], tar = (a[i][j] == '1');
    if (opt != tar) {
      ans++;
      r0[i] ^= 1;
      c0[j] ^= 1;
    }
  }
  for (int i = n - 1, j = 0; i != j; nex(i, j)) {
    int opt = r1[i] ^ c1[j], tar = (a[i][j] == '1');
    if (opt != tar) {
      ans++;
      r1[i] ^= 1;
      c1[j] ^= 1;
    }
  }
  for (int i = 0; i < n; i++) {
    int opt = r0[i] ^ c0[i] ^ r1[i] ^ c1[i], tar = (a[i][i] == '1');
    if (opt != tar) {
      ans++;
    }
  }
  printf("%d\n", ans);
}
int main() {
  while (scanf("%d", &n) != EOF) work();
  return 0;
}
