S = input R = range P = print def I(): return int(S()) def M(): return map(int, S().split()) def L(): return list(M()) def O(): return list(map(int, open(0).read().split())) def yn(b): print("Yes" if b else "No") biga = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" smaa = "abcdefghijklmnopqrstuvwxyz" h, w = M() a = [S() for _ in R(h)] ans = 0 for i in R(1 << (h + w - 2)): if bin(i).count('1') == h - 1: c = 1 ok = True ni, nj = 0, 0 for j in range(h + w - 2): if i & (1 << j): ni += 1 else: nj += 1 if a[ni][nj] == '#': ok = False elif a[ni][nj] == 'o': c += 1 else: c -= 1 if c < 0: ok = False if ok: ans += 1 print(ans)