#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > t;
long long n, m, res;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(20);
  cin >> n >> m;
  t = vector<vector<long long> >(n, vector<long long>(m));
  vector<long long> p = vector<long long>(100);
  p[0] = 1;
  for (long long i = 1; i < 100; ++i) p[i] = 2 * p[i - 1];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> t[i][j];
    }
  }
  res = 0;
  for (int i = 0; i < n; ++i) {
    long long blanc = 0, negre = 0;
    for (int j = 0; j < m; ++j) {
      if (t[i][j])
        blanc++;
      else
        negre++;
    }
    res += p[blanc] - 1;
    res += p[negre] - 1;
  }
  for (int j = 0; j < m; ++j) {
    long long blanc = 0, negre = 0;
    for (int i = 0; i < n; ++i) {
      if (t[i][j])
        blanc++;
      else
        negre++;
    }
    res += p[blanc] - 1;
    res += p[negre] - 1;
  }
  cout << res - n * m << endl;
}
