#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > a;
signed main() {
  int n, m;
  cin >> n >> m;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    a[i].resize(m);
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  long long rez = 0;
  for (int i = 0; i < n; i++) {
    int r1 = 0, r2 = 0;
    for (int j = 0; j < m; j++) {
      if (a[i][j])
        r1++;
      else
        r2++;
    }
    rez += (1ll << r1) + (1ll << r2);
    rez -= 2;
  }
  for (int i = 0; i < m; i++) {
    long long r1 = 0, r2 = 0;
    for (int j = 0; j < n; j++) {
      if (a[j][i] == 1)
        r1++;
      else
        r2++;
    }
    rez += (1ll << r1) + (1ll << r2);
    rez -= 2;
  }
  rez -= n * m;
  cout << rez;
  return 0;
}
