#include <bits/stdc++.h>
using namespace std;
const int OO = (int)1e5;
const double EPS = -(1e9);
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int a[55][55], n, m;
long long calc(long long x) {
  long long ret = 1;
  for (int(i) = 0; (i) < (int)(x); (i)++) ret *= 2;
  return ret - 1;
}
int main() {
  cin >> n >> m;
  for (int(i) = 0; (i) < (int)(n); (i)++)
    for (int(t) = 0; (t) < (int)(m); (t)++) cin >> a[i][t];
  long long ans = n * m, cnt = 0;
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    for (int(t) = 0; (t) < (int)(m); (t)++) {
      for (int T = t + 1; T < m; T++) {
        if (a[i][T] == a[i][t]) cnt++;
      }
      ans += calc(cnt);
      cnt = 0;
    }
  }
  for (int(t) = 0; (t) < (int)(m); (t)++) {
    for (int(i) = 0; (i) < (int)(n); (i)++) {
      for (int I = i + 1; I < n; I++) {
        if (a[I][t] == a[i][t]) cnt++;
      }
      ans += calc(cnt);
      cnt = 0;
    }
  }
  cout << ans;
}
