#include <bits/stdc++.h>
using namespace std;
long long int pow(long long int x) {
  long long int a = 1;
  for (int i = 0; i < x; i++) {
    a = a * 2;
  }
  return a - 1;
}
int main() {
  long long int n, m, row[50] = {0}, col[50] = {0};
  long long int ans = 0;
  cin >> n >> m;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      long long int x;
      cin >> x;
      if (x == 1) {
        row[i]++;
        col[j]++;
      }
    }
  }
  for (long long int i = 0; i < n; i++) {
    ans += pow(row[i]);
    ans += pow(m - row[i]);
  }
  for (long long int i = 0; i < m; i++) {
    ans += pow(col[i]);
    ans += pow(n - col[i]);
  }
  ans -= n * m;
  cout << ans << endl;
  return 0;
}
