#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 15;
inline int read() {
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x;
}
int g[2005][2005];
int row[2005], col[2005], mid[2005];
int main() {
  int n, ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) scanf("%1d", g[i] + j);
  memset(row, 0, sizeof row);
  memset(col, 0, sizeof col);
  for (int j = 1; j < n; j++)
    for (int i = n; i > j; i--) {
      if ((g[i][j] + row[i] + col[j]) & 1) {
        ans++;
        row[i]++;
        col[j]++;
      }
    }
  for (int i = 1; i <= n; i++) mid[i] = row[i] + col[i];
  memset(row, 0, sizeof row);
  memset(col, 0, sizeof col);
  for (int j = n; j > 1; j--)
    for (int i = 1; i < j; i++) {
      if ((g[i][j] + row[i] + col[j]) & 1) {
        ans++;
        row[i]++;
        col[j]++;
      }
    }
  for (int i = 1; i <= n; i++)
    if ((mid[i] + g[i][i] + col[i] + row[i]) & 1) ans++;
  cout << ans << endl;
  return 0;
}
