using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { this.N = int.Parse(Reader.ReadLine()); bool[][] map = new bool[this.N][]; for (int i = 0; i < this.N; i++) { map[i] = Reader.ReadLine().Select(a => a == '.').ToArray(); } int ans = GetAns(map); bool[][] tateyoko = new bool[this.N][]; for (int i = 0; i < this.N; i++) { tateyoko[i] = new bool[this.N]; for (int j = 0; j < this.N; j++) { tateyoko[i][j] = map[j][i]; } } ans = Math.Max(ans, GetAns(tateyoko)); bool gaisyu = true; for (int i = 0; i < this.N; i++) { if(!map[i][0]) { gaisyu = false; break; } if(!map[i].Last()) { gaisyu = false; break; } if(!map[0][i]) { gaisyu = false; break; } if(!map.Last()[i]) { gaisyu = false; break; } } if(gaisyu) { ans = Math.Max(ans, 4); } Console.WriteLine(ans); } private int GetAns(bool[][] map) { int ans = 0; int cnt = 0; for (int i = 0; i < this.N; i++) { if(map[i].Take(this.N-1).All(a=>a)) { cnt++; } } if(map.Select(a=>a.Last()).All(a=>a)) { cnt++; } ans = Math.Max(ans, cnt); cnt = 0; for (int i = 0; i < this.N; i++) { if(map[i].Skip(1).All(a=>a)) { cnt++; } } if(map.Select(a=>a.First()).All(a=>a)) { cnt++; } ans = Math.Max(ans, cnt); cnt = 0; for (int i = 0; i < this.N; i++) { if(map[i].Take(this.N-1).All(a=>a)||map[i].Skip(1).All(a=>a)) { cnt++; } } ans = Math.Max(ans, cnt); return ans; } private int N; public class Reader { private static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 5 ...#. ..#.# ..... #.... ##..# "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }