#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long mod = 1e9 + 7;
const long long N = 5e6 + 10;
const long long INF = 1e18;
const long long NINF = -1e18;
void solve() {
  long long n, m;
  cin >> n >> m;
  long long v[n][m];
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) {
      cin >> v[i][j];
    }
  long long zero = 0, one = 0;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    zero = 0;
    one = 0;
    for (long long j = 0; j < m; j++) {
      if (v[i][j] == 1)
        one++;
      else
        zero++;
    }
    ans += ((long long)(pow((long long)2, (long long)one) - 1));
    ans += ((long long)(pow((long long)2, (long long)zero) - 1));
  }
  for (long long j = 0; j < m; j++) {
    zero = 0;
    one = 0;
    for (long long i = 0; i < n; i++) {
      if (v[i][j] == 1)
        one++;
      else
        zero++;
    }
    ans += ((long long)(pow((long long)2, (long long)one) - 1));
    ans += ((long long)(pow((long long)2, (long long)zero) - 1));
  }
  cout << ans - (n * m) << "\n";
}
int main() {
  ios_base::sync_with_stdio;
  cin.tie(NULL);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
