#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
const int N = 100;
long long bit[60];
int n, m;
int a[N][N];
int main() {
  bit[0] = 1;
  for (int i = 1; i < 60; i++) bit[i] = bit[i - 1] << 1;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  long long ans = -n * m;
  for (int col = 0; col < 2; col++) {
    for (int i = 0; i < n; i++) {
      int cnt = 0;
      for (int j = 0; j < m; j++)
        if (col == a[i][j]) cnt++;
      ans += bit[cnt] - 1;
    }
    for (int j = 0; j < m; j++) {
      int cnt = 0;
      for (int i = 0; i < n; i++)
        if (col == a[i][j]) cnt++;
      ans += bit[cnt] - 1;
    }
  }
  cout << ans << endl;
  return 0;
}
