#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin >> N >> M; vector> Ss(N,vector(M)); for(auto &S : Ss) for(auto &s : S) cin >> s; auto rot = [&](vector &S) -> void { vector T(M,string(M,'.')); for(int i=0; i void { vector> B(M,vector(M)); for(int i=0; i void { if(pos == N){check(); return;} for(int i=0; i<4; i++) dfs(dfs,pos+1),rot(Ss.at(pos)); }; dfs(dfs,0); cout << answer << endl; }