#include <bits/stdc++.h>
using namespace std;
long long n, m, a[51][51], b, w, B, W, Pw[51], rec;
int32_t main() {
  cin >> n >> m;
  Pw[0] = 1;
  for (long long i = 1; i <= 50; ++i) Pw[i] = Pw[i - 1] << 1;
  for (long long i = 1; i <= n; ++i)
    for (long long j = 1; j <= m; ++j) cin >> a[i][j];
  for (long long i = 1; i <= n; ++i) {
    w = 0;
    for (long long j = 1; j <= m; ++j)
      if (a[i][j] == 0) ++w;
    W += Pw[w] - 1;
  }
  for (long long j = 1; j <= m; ++j) {
    w = 0;
    for (long long i = 1; i <= n; ++i)
      if (a[i][j] == 0) ++w;
    W += Pw[w] - 1 - w;
  }
  for (long long i = 1; i <= n; ++i) {
    b = 0;
    for (long long j = 1; j <= m; ++j)
      if (a[i][j]) ++b;
    B += Pw[b] - 1;
  }
  for (long long j = 1; j <= m; ++j) {
    b = 0;
    for (long long i = 1; i <= n; ++i)
      if (a[i][j]) ++b;
    B += Pw[b] - 1 - b;
  }
  cout << W + B << endl;
  return 0;
}
