#include <bits/stdc++.h>
using namespace std;
int a[55], b[55];
int main() {
  int n, m, temp;
  long long hang = 0, lie = 0;
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> temp;
      if (temp == 1) {
        a[i]++;
        b[j]++;
      }
    }
  for (int i = 0; i < n; i++) {
    hang += ((long long)pow(2, a[i]) - 1);
    hang += ((long long)pow(2, m - a[i]) - 1);
  }
  for (int i = 0; i < m; i++) {
    lie += ((long long)pow(2, b[i]) - 1);
    lie += ((long long)pow(2, n - b[i]) - 1);
  }
  cout << hang + lie - n * m;
  return 0;
}
