#include <bits/stdc++.h>
using namespace std;
long long Powar(long long num) {
  long long t = 1;
  for (int i = 1; i <= num; i++, t *= 2)
    ;
  return t - 1;
}
int main() {
  long long n, m;
  cin >> n >> m;
  long long ans = 0;
  bool stolb[50][50];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> stolb[i][j];
  for (int i = 0; i < n; ++i) {
    int hm1 = 0, hm2 = 0;
    for (int j = 0; j < m; ++j) {
      if (stolb[i][j])
        ++hm1;
      else
        ++hm2;
    }
    ans += Powar(hm1);
    ans += Powar(hm2);
  }
  for (int i = 0; i < m; ++i) {
    int hm1 = 0, hm2 = 0;
    for (int j = 0; j < n; ++j) {
      if (stolb[j][i])
        ++hm1;
      else
        ++hm2;
    }
    ans += Powar(hm1);
    ans += Powar(hm2);
  }
  ans -= (n * m);
  cout << ans;
  return 0;
}
