import java.io.*; import java.util.*; public class Main { static int n; static int m; static boolean[][] votes; static boolean[][] unables; static int[] dp; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); boolean[][] votes = new boolean[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { votes[i][j] = (sc.nextInt() == 1); } } boolean[][] unables = new boolean[1 << m][n]; for (int i = 0; i < (1 << m); i++) { for (int j = 0; j < m; j++) { if ((i & (1 << j)) != 0) { continue; } for (int k = 0; k < n; k++) { unables[i][k] |= !votes[k][j]; } } } int[] dp = new int[1 << m]; dp[0] = 1; for (int i = 1; i < (1 << m); i++) { for (int j = 0; j < m; j++) { if ((i & (1 << j)) == 0) { continue; } int agree = 0; int against = 0; for (int k = 0; k < n; k++) { if (unables[i][k]) { continue; } if (votes[k][j]) { agree++; } else { against++; } } if (agree >= against) { dp[i] += dp[i ^ (1 << j)]; } } } System.out.println(dp[(1 << m) - 1]); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }