#include <bits/stdc++.h>
using namespace std;
using namespace std;
int br[51], bc[51];
long long n, m, i, j, c, t, a[50][50], x = 1;
int main() {
  for (cin >> n >> m, i = 0; i < n; i++) {
    for (j = c = 0; j < m; j++) cin >> a[i][j], a[i][j] ? c++ : 0;
    t += (x << c) + (x << (m - c)) - 2;
  }
  for (j = 0; j < m; j++) {
    for (i = c = 0; i < n; i++) a[i][j] ? c++ : 0;
    t += (x << c) + (x << (n - c)) - 2;
  }
  cout << t - n * m;
}
