#include <bits/stdc++.h>
using namespace std;
const int N = (1 << 20);
const int inf = 0x3f3f3f3f;
int n, m;
char s[22][100005];
long long a[N], b[N];
void FWT(long long *a, int len, int o = 1) {
  for (int k = 0; 1 << k < len; k++)
    for (int i = (0); i < (len); i++)
      if (~i >> k & 1) {
        int j = i ^ (1 << k);
        long long x, y;
        x = a[i] + a[j], y = a[i] - a[j];
        if (o == -1) x = (long long)x / 2, y = (long long)y / 2;
        a[i] = x, a[j] = y;
      }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (1); i < (n + 1); i++) scanf("%s", s[i] + 1);
  for (int i = (1); i < (m + 1); i++) {
    int now = 0;
    for (int j = (1); j < (n + 1); j++) {
      now = now * 2 + s[j][i] - '0';
    }
    a[now]++;
  }
  for (int i = (0); i < (N); i++) {
    int t = __builtin_popcount(i);
    b[i] = min(t, n - t);
  }
  int len = (1 << n);
  FWT(a, len);
  FWT(b, len);
  for (int i = (0); i < (len); i++) a[i] = (long long)a[i] * b[i];
  FWT(a, len, -1);
  int ans = n * m;
  for (int i = (0); i < (len); i++) ans = min((long long)ans, a[i]);
  printf("%d\n", ans);
  return 0;
}
