#include <bits/stdc++.h>
using namespace std;
unsigned long long bgmod(unsigned long long b, unsigned long long p) {
  unsigned long long ans = 1;
  while (p) {
    if (p & 1) ans *= b;
    b *= b;
    p >>= 1;
  }
  return ans;
}
int main() {
  unsigned long long n, m;
  scanf("%llu %llu", &n, &m);
  unsigned long long ara[n + 1][m + 1];
  for (unsigned long long i = 1; i <= n; i++)
    for (unsigned long long j = 1; j <= m; j++) scanf("%llu", &ara[i][j]);
  unsigned long long ans = 0;
  for (unsigned long long i = 1; i <= n; i++) {
    unsigned long long zero = 0, one = 0;
    for (unsigned long long j = 1; j <= m; j++) {
      if (ara[i][j] == 0)
        zero++;
      else
        one++;
    }
    ans += (bgmod(2, zero) - 1);
    ans += (bgmod(2, one) - 1);
  }
  for (unsigned long long j = 1; j <= m; j++) {
    unsigned long long zero = 0, one = 0;
    for (unsigned long long i = 1; i <= n; i++) {
      if (ara[i][j] == 0)
        zero++;
      else
        one++;
    }
    if (zero > 1) ans += (bgmod(2, zero) - zero - 1);
    if (one > 1) ans += (bgmod(2, one) - one - 1);
  }
  printf("%llu\n", ans);
  return 0;
}
