#include <bits/stdc++.h>
using namespace std;
const int N = 55;
const int M = 1000000007;
int n, m;
int a[N][N];
int r[N][2], c[N][2];
int main() {
  while (~scanf("%d%d", &n, &m)) {
    memset(r, 0, sizeof(r));
    memset(c, 0, sizeof(c));
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        scanf("%d", &a[i][j]);
        r[i][a[i][j]]++;
        c[j][a[i][j]]++;
      }
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) {
      ans += (1ll << r[i][0]) - 1;
      ans += (1ll << r[i][1]) - 1;
    }
    for (int i = 0; i < m; i++) {
      ans += (1ll << c[i][0]) - c[i][0] - 1;
      ans += (1ll << c[i][1]) - c[i][1] - 1;
    }
    printf("%I64d\n", ans);
  }
}
