#include <bits/stdc++.h>
using namespace std;
string st;
long n, ar[2050][2050], s1[2050], s2[2050], s3[2050], s4[2050];
long cur, ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> st;
    for (int j = 1; j <= st.size(); j++) ar[i][j] = st[j - 1] - 48;
  }
  for (int i = 1; i <= n; i++)
    for (int j = n; j > i; j--) {
      cur = s1[i] + s2[j];
      cur %= 2;
      if (cur != ar[i][j]) {
        ++ans;
        ++s1[i];
        ++s2[j];
      }
    }
  for (int i = n; i; i--)
    for (int j = 1; j < i; j++) {
      cur = s3[i] + s4[j];
      cur %= 2;
      if (cur != ar[i][j]) {
        ++ans;
        ++s3[i];
        ++s4[j];
      }
    }
  for (int i = 1; i <= n; i++) {
    cur = s1[i] + s2[i] + s3[i] + s4[i];
    cur %= 2;
    if (cur != ar[i][i]) ++ans;
  }
  cout << ans << endl;
  cin.get();
  cin.get();
  return 0;
}
