#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000 + 10;
char num[MAXN][MAXN];
int C[MAXN];
int R[MAXN];
int D[MAXN];
int n;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> num[i][j];
  int ans = 0;
  for (int i = n - 1; i >= 0; i--)
    for (int j = 0; j < i; j++) {
      int ii = n - 1 - i;
      int jj = n - 1 - j;
      int sum = R[ii] + C[jj];
      sum %= 2;
      if (sum != (num[ii][jj] - '0')) {
        ans++;
        R[ii]++;
        C[jj]++;
      }
    }
  for (int i = 0; i < n; i++) {
    D[i] = (R[i] + C[i]) % 2;
    R[i] = C[i] = 0;
  }
  for (int i = n - 1; i >= 0; i--)
    for (int j = 0; j < i; j++) {
      int sum = R[i] + C[j];
      sum %= 2;
      if (sum != (num[i][j] - '0')) {
        ans++;
        R[i]++;
        C[j]++;
      }
    }
  for (int i = 0; i < n; i++)
    if ((D[i] + R[i] + C[i]) % 2 != (num[i][i] - '0')) ans++;
  cout << ans << '\n';
  return 0;
}
