#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int A[n][m];
  int R[n], C[m];
  long long P[64];
  P[0] = 1;
  for (int i = 1; i < 64; i++) P[i] = 2 * P[i - 1];
  for (int i = 0; i < n; i++) R[i] = 0;
  for (int i = 0; i < m; i++) C[i] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> A[i][j];
      if (A[i][j]) {
        R[i]++;
        C[j]++;
      }
    }
  }
  long long count = 0;
  for (int i = 0; i < n; i++) {
    count += P[R[i]] - 1 + P[m - R[i]] - 1;
  }
  for (int i = 0; i < m; i++) {
    count += P[C[i]] - 1 + P[n - C[i]] - 1;
  }
  cout << count - n * m << endl;
}
