#include <bits/stdc++.h>
using namespace std;
char ch[100001];
int N, n, m;
long long a[1 << 20], b[1 << 20];
int g[21][100001];
void FWT(long long p[], int flag) {
  int temp = N;
  for (int i = 2; i <= temp; i *= 2) {
    int t = i / 2;
    for (int j = 0; j < temp; j += i) {
      for (int k = j; k < j + t; k++) {
        long long x = p[k];
        long long y = p[k + t];
        p[k] = x + y;
        p[k + t] = x - y;
        if (flag == -1) {
          p[k] /= 2;
          p[k + t] /= 2;
        }
      }
    }
  }
}
int main() {
  cin >> n >> m;
  N = 1 << n;
  for (int i = 1; i <= n; i++) {
    scanf("%s", ch + 1);
    for (int j = 1; j <= m; j++) {
      g[i][j] = ch[j] - '0';
    }
  }
  for (int i = 1; i <= m; i++) {
    int x = 0;
    for (int j = 1; j <= n; j++) {
      x = (x * 2) | 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;
}
