#include <bits/stdc++.h>
using namespace std;
const long long int INF = (long long int)1e9 + 10;
const long long int INFLL = (long long int)1e18 + 10;
const long double EPS = 1e-8;
const long double EPSLD = 1e-18;
const long long int MOD = 1e9 + 7;
template <class T>
T &chmin(T &a, const T &b) {
  return a = min(a, b);
}
template <class T>
T &chmax(T &a, const T &b) {
  return a = max(a, b);
}
const int MAX_N = 2010;
int n;
char s[MAX_N][MAX_N];
int x[MAX_N][MAX_N];
int a[MAX_N], b[MAX_N], c[MAX_N], d[MAX_N];
int ans;
int main() {
  scanf("%d", &n);
  for (long long int i = (0); i < (long long int)(n); i++) scanf("%s", s[i]);
  for (long long int i = (0); i < (long long int)(n); i++)
    for (long long int j = (0); j < (long long int)(n); j++)
      x[i][j] = s[i][j] - '0';
  for (long long int i = (0); i < (long long int)(n); i++)
    for (int j = n - 1; j > i; j--) {
      if ((a[i] + b[j] + x[i][j]) % 2 == 1) {
        a[i]++;
        b[j]++;
        ans++;
      }
    }
  for (int i = n - 1; i >= 0; i--)
    for (long long int j = (0); j < (long long int)(i); j++) {
      if ((c[i] + d[j] + x[i][j]) % 2 == 1) {
        c[i]++;
        d[j]++;
        ans++;
      }
    }
  for (long long int i = (0); i < (long long int)(n); i++)
    if ((a[i] + b[i] + c[i] + d[i] + x[i][i]) % 2 == 1) ans++;
  printf("%d\n", ans);
  return 0;
}
