#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 50;   char s[MAX_N + 4];   int as[MAX_N][MAX_N], ass[MAX_N + 1][MAX_N + 1];   inline int area(int x0, int x1, int y0, int y1, int n) {     if (x0 < 0 || x1 > n || y0 < 0 || y1 > n) return 0;     return ass[y1][x1] - ass[y1][x0] - ass[y0][x1] + ass[y0][x0];   }   int main() {     int n;     scanf( %d , &n);     for (int y = n - 1; y >= 0; y--) {       scanf( %s , s);       for (int x = 0; x < n; x++) as[y][x] = s[x] -  0 ;     }     int s = 0;     for (int y = 0; y < n; y++)       for (int x = 0; x < n; x++) {         ass[y + 1][x + 1] = as[y][x] + ass[y][x + 1] + ass[y + 1][x] - ass[y][x];         s += as[y][x];       }     for (int y0 = 0; y0 < n; y0++)       for (int y1 = y0 + 1; y1 <= n; y1++)         for (int x0 = 0; x0 < n; x0++)           for (int x1 = x0 + 1; x1 <= n; x1++) {             int s4 = area(x0, x1, y0, y1, n);             int dx = x1 - x0, dy = y1 - y0;             if (s4 == 4 * dx * dy) {               int h0 = 0, h1 = 0, v0 = 0, v1 = 0;               int c00 = 0, c01 = 0, c10 = 0, c11 = 0;               if ((y0 <= 0 || (h0 = area(x0, x1, y0 - 1, y0, n)) == 2 * dx) &&                   (y1 >= n || (h1 = area(x0, x1, y1, y1 + 1, n)) == 2 * dx) &&                   (x0 <= 0 || (v0 = area(x0 - 1, x0, y0, y1, n)) == 2 * dy) &&                   (x1 >= n || (v1 = area(x1, x1 + 1, y0, y1, n)) == 2 * dy) &&                   (y0 <= 0 || x0 <= 0 || (c00 = as[y0 - 1][x0 - 1]) == 1) &&                   (y1 >= n || x0 <= 0 || (c01 = as[y1][x0 - 1]) == 1) &&                   (y0 <= 0 || x1 >= n || (c10 = as[y0 - 1][x1]) == 1) &&                   (y1 >= n || x1 >= n || (c11 = as[y1][x1]) == 1) &&                   s4 + h0 + h1 + v0 + v1 + c00 + c01 + c10 + c11 == s) {                 puts( Yes );                 return 0;               }             }           }     puts( No );     return 0;   }   