n, m = map(int, input().split()) s = [list(map(int, input().split())) for _ in range(n)] dp = [0] * (1 << m) dp[0] = 1 for i in range(1 << m): cnt = [0] * m t = 0 for k in range(n): for j in range(m): if s[k][j] == 0 and (i >> j) & 1: break else: t += 1 for j in range(m): cnt[j] += s[k][j] for j in range(m): if((i >> j) & 1) == 0 and cnt[j] * 2 >= t: dp[i | (1 << j)] += dp[i] print(dp[-1])