#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const long long MOD = 1000000007;
const double EPS = 1e-6;
int arr[55][55];
int n, m;
int numberOfInRow(int num, int i) {
  int res = 0;
  for (long long j = 0; j < (int)m; j++)
    if (arr[i][j] == num) res++;
  return res;
}
int numberOfInCol(int num, int j) {
  int res = 0;
  for (long long i = 0; i < (int)n; i++)
    if (arr[i][j] == num) res++;
  return res;
}
int main() {
  cin >> n >> m;
  if (n == 1 && m == 1) {
    cout << 1 << endl;
    return 0;
  }
  for (long long i = 0; i < (int)n; i++) {
    for (long long j = 0; j < (int)m; j++) cin >> arr[i][j];
  }
  long long ans = 0;
  for (long long i = 0; i < (int)n; i++) {
    int osR = numberOfInRow(0, i);
    int n1R = numberOfInRow(1, i);
    long long add =
        ((((long long)1) << osR) - 1) + ((((long long)1) << n1R) - 1);
    ans += (long long)add;
  }
  for (long long j = 0; j < (int)m; j++) {
    int osC = numberOfInCol(0, j);
    int n1C = numberOfInCol(1, j);
    long long add =
        ((((long long)1) << osC) - 1) + ((((long long)1) << n1C) - 1);
    ans += (long long)add;
  }
  cout << ans - (n * m) << endl;
  return 0;
}
