#include <bits/stdc++.h>
using namespace std;
long long n, m, a[51][51], rw[51], rb[51], cw[51], cb[51], f[51];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 0) {
        rw[i]++;
        cw[j]++;
      } else {
        rb[i]++;
        cb[j]++;
      }
    }
  }
  long long gg = 0;
  for (int i = 1; i <= n; i++) {
    gg += pow(2, rw[i]) + pow(2, rb[i]) - 2;
  }
  for (int i = 1; i <= m; i++) {
    gg += pow(2, cw[i]) + pow(2, cb[i]) - 2;
  }
  cout << gg - n * m << endl;
  return 0;
}
