#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-5;
const int inf = (1 << 31) - 1;
const int hinf = 0x3f3f3f3f;
const int mod = 1000000007;
int n;
char dat[2010][2010];
int a[2020], b[2020], c[2020], d[2020];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%s", &dat[i][1]);
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  memset(c, 0, sizeof(c));
  memset(d, 0, sizeof(d));
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = n; j > i; j--) {
      if ((dat[i][j] - '0' + a[i] + b[j]) & 1) {
        sum++;
        a[i]++;
        b[j]++;
      }
    }
  }
  for (int i = n; i >= 1; i--) {
    for (int j = 1; j < i; j++) {
      if ((dat[i][j] - '0' + c[i] + d[j]) & 1) {
        sum++;
        c[i]++;
        d[j]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if ((dat[i][i] - '0' + a[i] + b[i] + c[i] + d[i]) & 1) sum++;
  }
  cout << sum << endl;
}
