#include <bits/stdc++.h>
using namespace std;
int N, n, m;
long long a[1 << 20], b[1 << 20];
int g[21][100001];
void FWT(long long *P, int opt) {
  for (int i = 2; i <= N; i <<= 1)
    for (int p = i >> 1, j = 0; j < N; j += i)
      for (int k = j; k < j + p; ++k) {
        long long x = P[k], y = P[k + p];
        P[k] = x + y;
        P[k + p] = x - y;
        if (opt == -1) P[k] /= 2, P[k + p] /= 2;
      }
}
int main() {
  cin >> n >> m;
  N = 1 << n;
  char ch[100001];
  for (int i = 1; i <= n; ++i) {
    scanf("%s", ch + 1);
    for (int j = 1; j <= m; ++j) g[i][j] = ch[j] - 48;
  }
  for (int i = 1; i <= m; ++i) {
    int x = 0;
    for (int j = 1; j <= n; ++j) x = (x << 1) | g[j][i];
    a[x]++;
  }
  for (int i = 0; i < N; ++i) b[i] = b[i >> 1] + (i & 1);
  for (int i = 0; i < N; ++i) b[i] = min(b[i], n - b[i]);
  FWT(a, 1);
  FWT(b, 1);
  for (int i = 0; i < N; ++i) a[i] *= b[i];
  FWT(a, -1);
  long long ans = n * m;
  for (int i = 0; i < N; ++i) ans = min(ans, a[i]);
  printf("%I64d\n", ans);
  return 0;
}
