#include <bits/stdc++.h>
using namespace std;
int s[2005][2005];
int gRowUp[2005], gColUp[2005], gRowDown[2005], gColDown[2005];
char str[2005];
int main() {
  int n, i, j, row, col, to;
  scanf("%d\n", &n);
  for (i = 0; i < n; i++) {
    gets(str);
    for (j = 0; j < n; j++) s[i][j] = str[j] - '0';
  }
  to = n / 2;
  int ans = 0;
  for (i = 0; i < to; i++) {
    row = i;
    for (col = n - 1 - i; col > i; col--) {
      if ((gRowUp[row] + gColUp[col]) % 2 != s[row][col]) {
        gRowUp[row]++;
        gColUp[col]++;
        ans++;
      }
    }
    col = n - 1 - i;
    for (row = i + 1; row < n - 1 - i; row++) {
      if ((gRowUp[row] + gColUp[col]) % 2 != s[row][col]) {
        gRowUp[row]++;
        gColUp[col]++;
        ans++;
      }
    }
    row = n - 1 - i;
    for (col = i; col < n - 1 - i; col++) {
      if ((gRowDown[row] + gColDown[col]) % 2 != s[row][col]) {
        gRowDown[row]++;
        gColDown[col]++;
        ans++;
      }
    }
    col = i;
    for (row = n - 1 - i - 1; row > i; row--) {
      if ((gRowDown[row] + gColDown[col]) % 2 != s[row][col]) {
        gRowDown[row]++;
        gColDown[col]++;
        ans++;
      }
    }
  }
  for (i = 0; i < n; i++)
    if ((gRowUp[i] + gColUp[i] + gRowDown[i] + gColDown[i]) % 2 != s[i][i])
      ans++;
  printf("%d", ans);
  return 0;
}
