#include <bits/stdc++.h>
using namespace std;
int n, m;
int b[59][59];
long long x = 1, r[59], ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &b[i][j]);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (b[i][j]) r[i]++;
    }
    ans += x << (r[i]);
    r[i] = m - r[i];
    ans += x << (r[i]);
  }
  for (int j = 1; j <= m; j++) {
    r[j] = 0;
    for (int i = 1; i <= n; i++) {
      if (b[i][j]) r[j]++;
    }
    ans += x << (r[j]);
    r[j] = n - r[j];
    ans += x << (r[j]);
  }
  ans -= m * n + 2 * n + 2 * m;
  printf("%I64d", ans);
  return 0;
}
