import java.util.Arrays; import java.util.Scanner; public class Main_yukicoder43 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[][] s = new char[n][]; for (int i = 0; i < n; i++) { s[i] = sc.next().toCharArray(); } int m = n * (n - 1) / 2; int min = Integer.MAX_VALUE; for (int i = 0; i < 0x1 << m; i++) { min = Math.min(min, getMin(s, i)); } System.out.println(min); sc.close(); } private static int getMin(char[][] s, int i) { int n = s[0].length; int[] cnt = new int[n]; for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) { if (j == k) { continue; } if (s[j][k] == 'o') { cnt[j]++; } } } for (int j = 0; j < n; j++) { for (int k = j + 1; k < n; k++) { int tmp = (n - 1 - j) * (n - 1 - j - 1) / 2 + n - 1 - k; boolean win = (i & 0x1 << tmp) != 0; if (s[j][k] == 'x' && win) { return Integer.MAX_VALUE; } else if (s[j][k] == 'o' && !win) { return Integer.MAX_VALUE; } else if (s[j][k] == '-' && win) { cnt[j]++; } else if (s[j][k] == '-' && !win) { cnt[k]++; } } } int cnt0 = cnt[0]; Arrays.sort(cnt); int j; int prev = -1; int ret = 1; for (j = n - 1; j >= 0; j--) { if (prev == cnt[j]) { } else { if (cnt[j] <= cnt0) { break; } prev = cnt[j]; ret++; } } return ret; } }