#include <bits/stdc++.h>
using namespace std;
long long n, m, ans, mat[100][100];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cin >> mat[i][j];
    }
  }
  for (int i = 1; i <= n; ++i) {
    long long nr1 = 0, nr0 = 0;
    for (int j = 1; j <= m; ++j) {
      if (mat[i][j] == 1)
        ++nr1;
      else
        ++nr0;
    }
    ans += ((long long)1 << nr1) - (long long)1;
    ans += ((long long)1 << nr0) - (long long)1;
  }
  for (int j = 1; j <= m; ++j) {
    long long nr1 = 0, nr0 = 0;
    for (int i = 1; i <= n; ++i) {
      if (mat[i][j] == 1)
        ++nr1;
      else
        ++nr0;
    }
    ans += ((long long)1 << nr1) - (long long)1;
    ans += ((long long)1 << nr0) - (long long)1;
  }
  ans -= n * m;
  cout << ans;
  return 0;
}
