#include <bits/stdc++.h>
using namespace std;
template <class T>
void dbs(string str, T t) {
  cerr << str << " : " << t << "\n";
}
template <class T, class... S>
void dbs(string str, T t, S... s) {
  int idx = str.find(',');
  cerr << str.substr(0, idx) << " : " << t << ",";
  dbs(str.substr(idx + 1), s...);
}
template <class S, class T>
ostream& operator<<(ostream& os, const pair<S, T>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class S, class T>
ostream& operator<<(ostream& os, const map<S, T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
void prc(T a, T b) {
  cerr << "[";
  for (T i = a; i != b; ++i) {
    if (i != a) cerr << ", ";
    cerr << *i;
  }
  cerr << "]\n";
}
long long int P[55], n, m, ans;
bool A[55][55];
int main() {
  P[0] = 1;
  for (long long int i = (long long int)(1); i <= (long long int)(50); i++)
    P[i] = P[i - 1] * 2;
  cin >> n >> m;
  for (long long int i = (long long int)(1); i <= (long long int)(n); i++)
    for (long long int j = (long long int)(1); j <= (long long int)(m); j++)
      cin >> A[i][j];
  for (long long int i = (long long int)(1); i <= (long long int)(n); i++) {
    long long int c = 0;
    for (long long int j = (long long int)(1); j <= (long long int)(m); j++)
      if (A[i][j]) c++;
    long long int d = m - c;
    ans += P[c] + P[d] - 2;
  }
  for (long long int j = (long long int)(1); j <= (long long int)(m); j++) {
    long long int c = 0;
    for (long long int i = (long long int)(1); i <= (long long int)(n); i++)
      if (A[i][j]) c++;
    long long int d = n - c;
    ans += P[c] + P[d] - 2;
  }
  ans -= m * n;
  cout << ans;
}
