#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long long n, m, x, r[101][10], c[101][10], ans;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cin >> x;
      r[i][x]++;
      c[j][x]++;
    }
  }
  for (long long i = 1; i <= n; i++) {
    ans += (1LL << r[i][0]) - r[i][0] - 1;
    ans += (1LL << r[i][1]) - r[i][1] - 1;
  }
  for (long long i = 1; i <= m; i++) {
    ans += (1LL << c[i][0]) - 1;
    ans += (1LL << c[i][1]) - 1;
  }
  return cout << ans, 0;
}
