#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 101e7;
template <class T>
T sqr(T first) {
  return first * first;
}
template <class T>
T abs(T first) {
  return (first < 0) ? -first : first;
}
int main() {
  int n;
  scanf("%d\n", &n);
  vector<vector<int> > a(n + 2, vector<int>(n + 2, 0));
  char q;
  for (int _b = (n), i = (1); i <= _b; i++) {
    for (int _b = (n), j = (1); j <= _b; j++) {
      scanf("%c", &q);
      a[i][j] = int(q) - 48;
    }
    scanf("%c", &q);
  }
  vector<int> v(n + 2, 0), h(n + 2, 0);
  int sol = 0;
  for (int _b = (n - 1), i = (1); i <= _b; i++) {
    for (int j = (n), _b = (i + 1); j >= _b; j--) {
      if ((a[i][j] + v[j] + h[i]) & 1) {
        ++sol;
        ++v[j];
        ++h[i];
      }
    }
  }
  vector<int> h1(h.begin(), h.end()), v1(v.begin(), v.end());
  h.clear();
  v.clear();
  h.resize(n + 2, 0);
  v.resize(n + 2, 0);
  for (int i = (n), _b = (2); i >= _b; i--) {
    for (int _b = (i - 1), j = (1); j <= _b; j++) {
      if ((a[i][j] + v[j] + h[i]) & 1) {
        ++sol;
        ++h[i];
        ++v[j];
        ++v1[j];
        ++h1[i];
      }
    }
  }
  for (int _b = (n), i = (1); i <= _b; i++) {
    if ((a[i][i] + h1[i] + v1[i]) & 1) ++sol;
  }
  cout << sol << endl;
  return 0;
}
