import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #input = sys.stdin.readline h,w = map(int,input().split()) grid = [list(input().rstrip()) for i in range(h)] ans = 0 for i in itertools.product([0,1],repeat=h+w-2): temp = 1 x,y = 0,0 check = 1 for j in range(h+w-2): if i[j] == 0: x += 1 else: y += 1 if 0 <= x < h and 0 <= y < w: if temp == 0 and grid[x][y] == 'x' or grid[x][y] == '#': check = 0 break temp += 1 if grid[x][y] == 'o' else 0 if grid[x][y] == '#' else -1 else: check = 0 break ans += check print(ans)