#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18, MOD = 1e9 + 7, SQRT = 350;
inline void smin(long long &x, long long y) { x = min(x, y); }
inline void smax(long long &x, long long y) { x = max(x, y); }
const long long N = 50 + 10;
long long n, m;
bool a[N][N];
long long r[N], l[N];
long long pw[N + 10];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  pw[0] = 1;
  for (long long i = 1; i <= 60; i++) pw[i] = 2 * pw[i - 1];
  cin >> n >> m;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) cin >> a[i][j];
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      l[i] += a[i][j];
      r[j] += a[i][j];
    }
  }
  long long res = 0;
  for (long long i = 1; i <= n; i++) {
    res += pw[l[i]] - 1, res += pw[m - l[i]] - 1;
  }
  for (long long i = 1; i <= m; i++)
    res += pw[r[i]] - 1, res += pw[n - r[i]] - 1;
  cout << res - n * m;
}
