#include <bits/stdc++.h>
const int INF = ~0U >> 1;
using namespace std;
int n, m;
long long ans;
int a[55][55];
int row0[55], row1[55];
int col0[55], col1[55];
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])
        ++row1[i], ++col1[j];
      else
        ++row0[i], ++col0[j];
    }
  }
  for (int i = 1; i <= n; ++i) {
    ans += pow(2, row1[i]) - 1 + pow(2, row0[i]) - 1;
  }
  for (int j = 1; j <= m; ++j) {
    ans += pow(2, col1[j]) - 1 + pow(2, col0[j]) - 1;
  }
  cout << ans - m * n << endl;
  return 0;
}
