#include using namespace std; using ll = long long; int main() { int h, w; cin >> h >> w; char a[h][w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> a[i][j]; } } int ans = 0; for (int i = 0; i < 1 << (h + w - 2); i++) { int x = 0, y = 0; int p = 1; for (int j = 0; j < h + w - 2; j++) { if (i & (1 << j)) { x++; } else { y++; } if (x >= h || y >= w) { p = -999; break; } if (a[x][y] == '#') { p = -999; break; } if (a[x][y] == 'o') { p++; } if (a[x][y] == 'x') { p--; if (p == -1) { p = -999; break; } } } if (p >= 0) { ans++; } } cout << ans << endl; return 0; }