#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define MT make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)<; using vi = vector; using vll = vector; int S[5000][12], dp[1 << 12]; void solve() { int N, M; cin >> N >> M; rep(i, N)rep(j, M) { cin >> S[i][j]; } dp[0] = 1; rep(T, 1 << M) { static int U[5000]; // 議員残存 fill(U, U + N, 1); int n = N; // 残り議員数 rep(j, M)if (T >> j & 1) { rep(i, N) if (!S[i][j] && U[i]) { U[i] = 0; n--; } } rep(j, M)if (!(T >> j & 1)) { int x = 0; // 賛成者 rep(i, N)if (S[i][j] && U[i]) { x++; } if (x * 2 >= n) { dp[T | 1 << j] += dp[T]; } } } cout << dp[(1 << M) - 1] << endl; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); solve(); return 0; }