func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 2010;   int A[M][M];   int col[M];   int diag[M];   int main() {     ios_base::sync_with_stdio(false);     int i, j, k, n;     char str[M];     scanf( %d , &n);     for (i = 0; i < n; i++) {       scanf( %s , str);       for (j = 0; j < n; j++) A[i][j] = str[j] -  0 ;     }     int sum = 0;     for (i = n - 1; i > 0; i--) {       int inv = 0;       for (j = 0; j < i; j++) {         if (A[i][j] != (inv ^ col[j])) {           inv ^= 1;           sum++;           diag[i] ^= 1;           diag[j] ^= 1;           col[j] ^= 1;         }       }     }     memset((col), (0), sizeof(col));     for (i = 0; i < n - 1; i++) {       int inv = 0;       for (j = n - 1; j > i; j--) {         if (A[i][j] != (inv ^ col[j])) {           inv ^= 1;           sum++;           diag[i] ^= 1;           diag[j] ^= 1;           col[j] ^= 1;         }       }     }     for (i = 0; i < n; i++)       if (A[i][i] != diag[i]) sum++;     printf( %d n , sum);     return 0;   }   