#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
void printDouble(double x, int n) {
  cout << fixed << setprecision(n);
  cout << x << endl;
}
const int MAXN = 5e6 + 5;
const int mod = 1e9 + 7;
long long product() { return 1; }
long long sum() { return 0; }
template <typename T, typename... Args>
T product(T a, Args... args) {
  return (a * product(args...)) % mod;
}
template <typename T, typename... Args>
T sum(T a, Args... args) {
  return (a + sum(args...)) % mod;
}
long long e2(long long x) {
  if (x == 0) return 1;
  if (x == 1) return 2;
  if (x % 2 == 0) {
    long long y = e2(x / 2);
    return (y * y);
  }
  return 2 * (e2(x - 1));
}
int main() {
  std::ios::sync_with_stdio(false);
  int x, n, m;
  cin >> n >> m;
  vector<vector<int> > numRow(2, vector<int>(n + 1, 0)),
      numCol(2, vector<int>(m + 1, 0));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> x;
      numRow[x][i]++;
      numCol[x][j]++;
    }
  long long res = 0;
  for (int i = 0; i <= 1; i++)
    for (int j = 1; j <= n; j++) res += e2(numRow[i][j]);
  for (int i = 0; i <= 1; i++)
    for (int j = 1; j <= m; j++) res += e2(numCol[i][j]);
  cout << res - 2 * n - 2 * m - n * m << endl;
}
