#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = 0;
  int n, m;
  cin >> n >> m;
  bool a[60][60] = {0, 0, 0, 0, 0};
  for (int i = 0; i < n; i++) {
    long long n1 = 0, n2 = 0;
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 1) n1++;
    }
    n2 = m - n1;
    long long k = 1;
    ans += (k << n1);
    ans--;
    ans += (k << n2);
    ans--;
  }
  for (int i = 0; i < m; i++) {
    long long n1 = 0, n2 = 0;
    for (int j = 0; j < n; j++) {
      if (a[j][i] == 1) n1++;
    }
    n2 = n - n1;
    long long k = 1;
    ans += (k << n1);
    ans += (k << n2);
    ans -= n;
    ans -= 2;
  }
  cout << ans;
}
