#include <bits/stdc++.h>
using namespace std;
int a[50][50];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  int i, j, k;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) scanf("%d", &a[i][j]);
  long long ans = 0;
  int v1, v2, f1, f2;
  for (i = 0; i < n; i++) {
    v1 = v2 = 0;
    for (j = 0; j < m; j++) v1 += a[i][j], v2 += !a[i][j];
    ans += (1LL << v1) - 1LL;
    ans += (1LL << v2) - 1LL;
  }
  for (j = 0; j < m; j++) {
    v1 = v2 = 0;
    for (i = 0; i < n; i++) v1 += a[i][j], v2 += !a[i][j];
    ans += (1LL << v1) - 1LL - v1;
    ans += (1LL << v2) - 1LL - v2;
  }
  printf("%I64d\n", ans);
  return 0;
}
