using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, m) = (c[0], c[1]); var map = NArr(n); var bitmax = 1 << m; var num = new int[bitmax]; for (var i = 0; i < n; ++i) { var d = 0; for (var j = 0; j < m; ++j) d = d * 2 + map[i][j]; ++num[d]; } var num2 = new int[bitmax]; for (var i = 0; i < bitmax; ++i) for (var j = 0; j < bitmax; ++j) { if ((i | j) == j) num2[i] += num[j]; } var dp = new int[bitmax]; dp[^1] = 1; for (var i = bitmax - 1; i > 0; --i) { for (var j = 0; j < m; ++j) { var next = i ^ (1 << j); if ((i | next) == i && num2[i] * 2 >= num2[next]) dp[next] += dp[i]; } } WriteLine(dp[0]); } }