#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void fwht(int *p, int n) {
  for (int len = 1; 2 * len <= n; len <<= 1) {
    for (int i = 0; i < n; i += 2 * len) {
      for (int j = 0; j < len; j++) {
        int a = p[i + j];
        int b = p[i + j + len];
        p[i + j] = a + b >= mod ? a + b - mod : a + b;
        p[i + j + len] = a - b < 0 ? a - b + mod : a - b;
      }
    }
  }
}
int p[1 << 20];
int a[20][100000], n, m;
int A[1 << 20], B[1 << 20];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char c;
      scanf(" %c", &c);
      a[i][j] = c - '0';
    }
  }
  B[1] = 1;
  for (int i = 2; i < (1 << n); i++) B[i] = B[i >> 1] + (i & 1);
  for (int i = 0; i < (1 << n); i++) B[i] = min(B[i], n - B[i]);
  for (int j = 0; j < m; j++) {
    int x = 0;
    for (int i = 0; i < n; i++)
      if (a[i][j]) x |= 1 << i;
    ++A[x];
  }
  fwht(A, 1 << n);
  fwht(B, 1 << n);
  for (int i = 0; i < (1 << n); i++) A[i] = (long long)A[i] * B[i] % mod;
  fwht(A, 1 << n);
  int inv = 500000004, pow2 = 1;
  for (int i = 0; i < n; i++) pow2 = (long long)pow2 * inv % mod;
  int ans = 1e9;
  for (int i = 0; i < (1 << n); i++) {
    A[i] = (long long)A[i] * pow2 % mod;
    ans = min(ans, A[i]);
  }
  printf("%d\n", ans);
}
