// Arup Guha
// 2/24/2017
// Solution to 2017 January USACO Bronze Problem: Cow Tip

import java.util.*;
import java.io.*;

public class cowtip {

	public static int n;
	public static boolean[][] grid;

	public static void main(String[] args) throws Exception {

		Scanner stdin = new Scanner(new File("cowtip.in"));
		n = stdin.nextInt();
		grid = new boolean[n][n];

		// Read grid, store as boolean array.
		for (int i=0; i<n; i++) {
			String s = stdin.next();
			for (int j=0; j<n; j++)
				grid[i][j] = (s.charAt(j) == '1');
		}

		int res = 0;

		// Go backwards through each diagonal.
		for (int diag=2*n-2; diag>=0; diag--) {

			// Just go forward through each row.
			for (int i=0; i<n; i++) {

				// Skip invalid squares.
				int j = diag-i;
				if (j >= n || j < 0) continue;

				// If this square needs to be changed, run a toggle.
				if (grid[i][j]) {
					toggle(i, j);
					res++;
				}
			}
		}

		// Output the result.
		PrintWriter out = new PrintWriter(new FileWriter("cowtip.out"));
		out.println(res);

		out.close();
		stdin.close();
	}

	public static void toggle(int x, int y) {
		for (int i=0; i<=x; i++)
			for (int j=0; j<=y; j++)
				grid[i][j] = !grid[i][j];
	}
}