#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long na[51], ans = 0;
  for (long long i = 0; i <= 50; i++) na[i] = pow(2, i) - 1;
  int m, n;
  cin >> m >> n;
  int a[m][n];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) cin >> a[i][j];
  int ones;
  for (int i = 0; i < m; i++) {
    ones = 0;
    for (int j = 0; j < n; j++) {
      ones += a[i][j];
    }
    ans += (na[ones] + na[n - ones]);
  }
  for (int i = 0; i < n; i++) {
    ones = 0;
    for (int j = 0; j < m; j++) {
      ones += a[j][i];
    }
    ans += (na[ones] + na[m - ones] - m);
  }
  cout << ans;
  return 0;
}
