#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100;
int a[MAXN][MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i(0); i < n; i++)
    for (int j(0); j < m; j++) cin >> a[i][j];
  unsigned long long ans = 0;
  for (int i(0); i < n; i++) {
    unsigned long long c1 = 0;
    unsigned long long c0 = 0;
    for (int j(0); j < m; j++) {
      if (a[i][j] == 1)
        c1++;
      else
        c0++;
    }
    ans = ans + (((unsigned long long)1 << c1) - 1);
    ans = ans + (((unsigned long long)1 << c0) - 1);
  }
  for (int i(0); i < m; i++) {
    unsigned long long c1 = 0;
    unsigned long long c0 = 0;
    for (int j(0); j < n; j++) {
      if (a[j][i] == 1)
        c1++;
      else
        c0++;
    }
    ans = ans + (((unsigned long long)1 << c1) - 1);
    ans = ans + (((unsigned long long)1 << c0) - 1);
  }
  cout << ans - n * m;
  return 0;
}
