#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  int matriz[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> matriz[i][j];
    }
  }
  long long casilleros = n * m;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int blanco = 0, negro = 0;
    for (int j = 0; j < m; j++) {
      if (matriz[i][j] == 1) {
        blanco++;
      } else {
        negro++;
      }
    }
    ans += (long long)(pow(2, blanco) - 1);
    ans += (long long)(pow(2, negro) - 1);
  }
  for (int j = 0; j < m; j++) {
    int blanco = 0, negro = 0;
    for (int i = 0; i < n; i++) {
      if (matriz[i][j] == 1) {
        blanco++;
      } else {
        negro++;
      }
    }
    ans += (long long)(pow(2, blanco) - 1);
    ans += (long long)(pow(2, negro) - 1);
  }
  cout << ans - casilleros << '\n';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int t = 1;
  while (t--) solve();
}
