import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class No3558 { public static String[][] str; public static boolean[][] tf; public static void main(String[] args) throws IOException{ String[] strings = readStr(); int n = Integer.parseInt(strings[0]); str = new String[n][n*2]; for(int i = 1;i <= n;i++) { str[i-1] = strings[i].split(""); } int count = getCount(n); System.out.println(count); } public static int getCount(int n) { int countx = 0 , county = 0 , count = 0; for(int i = 0;i < str.length;i++) { for(int j = 0;j < str.length;j++ ) { if(".".equals(str[i][j])){ countx += j+1; county++; } if(".".equals(str[i][j+n])) { countx += j + 1 + n; county++; } } if(i < str.length-1) { count += Math.abs(county- (i+1) * str.length); } } count += countx - n*n*(n+1)/2; return count; } public static String[] readStr() throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList list = new ArrayList<>(); do { list.add(br.readLine()); }while(br.ready()); br.close(); String[] text = new String[list.size()]; list.toArray(text); return text; } }