#include <bits/stdc++.h>
using namespace std;
int a[2010][2010], row[2010][2010], col[2010][2010];
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      char c;
      cin >> c;
      a[i][j] = c - '0';
    }
  int ret = 0;
  memset(row, 0, sizeof row);
  memset(col, 0, sizeof col);
  for (int i = n; i >= 1; i--)
    for (int j = 1; j < i; j++) {
      col[i][j] += col[i + 1][j];
      row[i][j] += row[i][j - 1];
      if ((col[i][j] + row[i][j] + a[i][j]) % 2 == 1) {
        ret++;
        a[i][j] = 0;
        col[i][j]++;
        row[i][j]++;
      }
    }
  for (int i = 1; i <= n; i++)
    for (int j = n; j > i; j--) {
      col[i][j] += col[i - 1][j];
      row[i][j] += row[i][j + 1];
      if ((col[i][j] + row[i][j] + a[i][j]) % 2 == 1) {
        ret++;
        a[i][j] = 0;
        col[i][j]++;
        row[i][j]++;
      }
    }
  for (int i = 1; i <= n; i++) {
    col[i][i] += col[i - 1][i] + col[i + 1][i];
    row[i][i] += row[i][i - 1] + row[i][i + 1];
    if ((col[i][i] + row[i][i] + a[i][i]) % 2 == 1) {
      ret++;
    }
  }
  cout << ret;
  return 0;
}
