local ior = io.input() local n = ior:read("*n", "*l") local tot = math.floor(n * (n - 1) / 2) local t = {} for i = 1, tot do t[i] = 0 end local str, sstr = "", "" local function getidx(row, col) local ret = 0 for i = 1, row - 1 do ret = ret + n - i end ret = ret + (col - row) return ret end for i = 1, n do str = ior:read() for j = i + 1, n do sstr = str:sub(j, j) local idx = getidx(i, j) if(sstr == "o") then t[idx] = 1 elseif(sstr == "x") then t[idx] = -1 end end end local allpat = 1 for i = 1, tot do allpat = allpat * 2 end local highrank = n for i_tot = 0, allpat - 1 do local tmpi = i_tot local subt = {} for j = 1, tot do table.insert(subt, (tmpi % 2) * 2 - 1) tmpi = math.floor(tmpi / 2) end local isok = true for j = 1, tot do if(t[j] ~= 0 and t[j] ~= subt[j]) then isok = false break end end if(isok) then local kati = {} for i = 1, n do kati[i] = 0 end for i = 1, n - 1 do for j = i + 1, n do local idx = getidx(i, j) if(subt[idx] == 1) then kati[i] = kati[i] + 1 else kati[j] = kati[j] + 1 end end end local num_per_kati = {} for i = 1, n do num_per_kati[i] = false end for i = 1, n do num_per_kati[kati[i] + 1] = true end local rank = 1 for i = n, 1, -1 do if(num_per_kati[i]) then if(kati[1] + 1 == i) then break else rank = rank + 1 end end end highrank = math.min(highrank, rank) end end print(highrank)