#include <bits/stdc++.h>
using namespace std;
const int MAX = 2100;
int n, operations, curr_r[MAX], curr_c[MAX], m[MAX][MAX];
void limpa() {
  for (int i = 0; i < MAX; i++) curr_r[i] = curr_c[i] = 0;
  operations = 0;
}
void le() {
  char c;
  scanf(" %d", &n);
  limpa();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      scanf(" %c", &c);
      m[i][j] = (int)(c - '0');
    }
  }
}
void solve(int i, int j) {
  if ((m[i][j] + curr_r[i] + curr_c[j]) % 2 == 0) return;
  curr_r[i]++;
  curr_c[j]++;
  operations++;
}
void resolve() {
  for (int i = 1; i <= n; i++)
    for (int j = n; j > i; j--) solve(i, j);
  for (int i = 1; i <= n; i++) {
    m[i][i] = (m[i][i] + curr_r[i] + curr_c[i]) % 2;
    curr_r[i] = curr_c[i] = 0;
  }
  for (int i = n; i >= 1; i--)
    for (int j = 1; j < i; j++) solve(i, j);
  for (int i = 1; i <= n; i++) {
    m[i][i] = (m[i][i] + curr_r[i] + curr_c[i]) % 2;
    operations += m[i][i];
  }
}
void imprime() { printf("%d\n", operations); }
int main() {
  le();
  resolve();
  imprime();
  return 0;
}
