import java.util.*;
import java.io.*;
public class Main {
static int R, C, result;
static char[][] map;
static int[] dr = { -1, 0, 1 };
static int[] dc = { 1, 1, 1 };
static boolean[][] isSelected;
static boolean check;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
R = Integer.parseInt(st.nextToken());
C = Integer.parseInt(st.nextToken());
map = new char[R][C];
for (int i = 0; i < R; i++) {
String str = br.readLine();
for (int j = 0; j < C; j++) {
map[i][j] = str.charAt(j);
}
}
result = 0;
isSelected = new boolean[R][C];
for (int i = 0; i < R; i++) {
check = false;
pipe(i, 0);
}
System.out.println(result);
br.close();
}
static void pipe(int r, int c) {
if (c == C - 1) {
result++;
check = true;
return;
}
for (int i = 0; i < dr.length; i++) {
int nr = r + dr[i];
int nc = c + dc[i];
if (0 <= nr && nr < R && 0 <= nc && nc < C && !isSelected[nr][nc] && map[nr][nc] != 'x') {
isSelected[nr][nc] = true;
pipe(nr, nc);
if(check) return;
}
}
return;
}
}