import sys input = sys.stdin.readline sys.setrecursionlimit(10**8) from more_itertools import distinct_permutations H, W = map(int, input().split()) A = [list(input()[:-1]) for _ in range(H)] ans = 0 for E in distinct_permutations([0] * (H - 1) + [1] * (W - 1)): cnt = 1 y, x = 0, 0 flag = True for e in E: if e == 0: y += 1 else: x += 1 if A[y][x] == "o": cnt += 1 if A[y][x] == "x": cnt -= 1 if cnt < 0: flag = False break if A[y][x] == "#": flag = False break if not flag: continue ans += 1 print(ans)