#include <bits/stdc++.h>
using namespace std;
int n, m, a[55][55], k1, k0;
long long s;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    k1 = 0;
    k0 = 0;
    for (int j = 1; j <= m; ++j) {
      cin >> a[i][j];
      if (a[i][j])
        k1++;
      else
        k0++;
    }
    s += (1LL << k1) - 1;
    s += (1LL << k0) - 1;
  }
  for (int j = 1; j <= m; ++j) {
    k1 = 0;
    k0 = 0;
    for (int i = 1; i <= n; ++i)
      if (a[i][j])
        k1++;
      else
        k0++;
    s += (1LL << k1) - 1 - k1;
    s += (1LL << k0) - 1 - k0;
  }
  cout << s;
  return 0;
}
