#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int a[n + 1][m + 1];
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    int one = 0, zero = 0;
    for (long long j = 1; j <= m; j++) {
      cin >> a[i][j];
      if (a[i][j])
        one++;
      else
        zero++;
    }
    ans += (long long)pow(2, one) - 1;
    ans += (long long)pow(2, zero) - 1;
  }
  for (long long i = 1; i <= m; i++) {
    int one = 0, zero = 0;
    for (long long j = 1; j <= n; j++) {
      if (a[j][i])
        one++;
      else
        zero++;
    }
    ans += (long long)pow(2, one) - 1;
    ans += (long long)pow(2, zero) - 1;
  }
  cout << ans - n * m;
  return 0;
}
