#include <bits/stdc++.h>
int main() {
  int r, c, i, j, w = 0, b = 0;
  long long int result = 0;
  int arr[52][52];
  scanf("%d%d", &r, &c);
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++) {
      scanf("%d", &arr[i][j]);
    }
  }
  for (i = 0; i < r; i++) {
    w = 0;
    b = 0;
    for (j = 0; j < c; j++) {
      if (arr[i][j] == 0) {
        w++;
      }
      if (arr[i][j] == 1) {
        b++;
      }
    }
    result += pow(2, w) - 1;
    result += pow(2, b) - 1;
  }
  for (i = 0; i < c; i++) {
    w = 0;
    b = 0;
    for (j = 0; j < r; j++) {
      if (arr[j][i] == 0) {
        w++;
      }
      if (arr[j][i] == 1) {
        b++;
      }
    }
    result += pow(2, w) - 1;
    result += pow(2, b) - 1;
  }
  printf("%lld", result - r * c);
  return 0;
}
