#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, i, j, k, l, ans = 0, sum = 0, x, y, z, mx = 0, mn = 2e9,
                              a[105][105] = {0}, flag = 0;
  cin >> n >> m;
  long long cnt0 = 0, cnt1 = 0, p;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < n; i++) {
    cnt0 = 0;
    cnt1 = 0;
    p = 1;
    for (j = 0; j < m; j++) {
      if (a[i][j] == 0) {
        cnt0++;
      }
    }
    k = p << cnt0;
    k--;
    ans += k;
    for (j = 0; j < m; j++) {
      if (a[i][j] == 1) {
        cnt1++;
      }
    }
    k = p << cnt1;
    k--;
    ans += k;
  }
  for (i = 0; i < m; i++) {
    cnt0 = 0;
    cnt1 = 0;
    p = 1;
    for (j = 0; j < n; j++) {
      if (a[j][i] == 0) {
        cnt0++;
      }
    }
    k = p << cnt0;
    k--;
    ans += k;
    for (j = 0; j < n; j++) {
      if (a[j][i] == 1) {
        cnt1++;
      }
    }
    k = p << cnt1;
    k--;
    ans += k;
  }
  cout << ans - (n * m);
  return 0;
}
