#include <bits/stdc++.h>
using namespace std;
int a[55][55];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  long long res = 0;
  for (int i = 0; i < n; i++) {
    int sum0 = 0;
    int sum1 = 0;
    for (int j = 0; j < m; j++) {
      sum0 += a[i][j] == 0;
      sum1 += a[i][j] == 1;
    }
    if (sum0) {
      res += (1LL << sum0) - 1;
    }
    if (sum1) {
      res += (1LL << sum1) - 1;
    }
  }
  for (int j = 0; j < m; j++) {
    int sum0 = 0;
    int sum1 = 0;
    for (int i = 0; i < n; i++) {
      sum0 += a[i][j] == 0;
      sum1 += a[i][j] == 1;
    }
    if (sum0) {
      res += (1LL << sum0) - 1;
    }
    if (sum1) {
      res += (1LL << sum1) - 1;
    }
  }
  cout << res - (m * n);
  return 0;
}
