#include <bits/stdc++.h>
using namespace std;
int a[100][100], blckc[100], blckr[100], whtc[100], whtr[100];
long long ans;
int main() {
  int n, m;
  while (cin >> n >> m) {
    memset(blckc, 0, sizeof blckc);
    memset(blckr, 0, sizeof blckr);
    memset(whtc, 0, sizeof whtc);
    memset(whtr, 0, sizeof whtr);
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        scanf("%d", &a[i][j]);
        if (a[i][j] == 0) {
          ++blckr[i];
          ++blckc[j];
        } else {
          ++whtr[i];
          ++whtc[j];
        }
      }
    }
    ans = 0;
    for (int i = 0; i < n; ++i) {
      ans += (1ll << blckr[i]) - 1;
      ans += (1ll << whtr[i]) - 1;
    }
    for (int i = 0; i < m; ++i) {
      ans += (1ll << blckc[i]) - 1;
      ans += (1ll << whtc[i]) - 1;
    }
    ans -= n * m;
    cout << ans << endl;
  }
  return 0;
}
