#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long inf = 1LL << 62;
const long long mx = 100005;
long long dx[10] = {1, 0, -1, 0};
long long dy[10] = {0, -1, 0, 1};
long long arr[55][55];
int main() {
  long long tst, a, b, c, k, n, m, res = 0, ans = 0, t = 0;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cin >> arr[i][j];
    }
  }
  for (long long i = 1; i <= n; i++) {
    a = 0, b = 0;
    for (long long j = 1; j <= m; j++) {
      if (arr[i][j])
        a++;
      else
        b++;
    }
    res += ((long long)pow(2LL, a) - 1);
    res += ((long long)pow(2LL, b) - 1);
  }
  for (long long i = 1; i <= m; i++) {
    a = 0, b = 0;
    for (long long j = 1; j <= n; j++) {
      if (arr[j][i])
        a++;
      else
        b++;
    }
    res += ((long long)pow(2LL, a) - 1);
    res += ((long long)pow(2LL, b) - 1);
    res -= (a + b);
  }
  cout << res << "\n";
  return 0;
}
