#include <bits/stdc++.h>
inline long long read() {
  long long x = 0;
  char c = getchar(), f = 1;
  for (; c < '0' || '9' < c; c = getchar())
    if (c == '-') f = -1;
  for (; '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
inline void write(long long x) {
  static char buf[20];
  int len = 0;
  if (x < 0) putchar('-'), x = -x;
  for (; x; x /= 10) buf[len++] = x % 10 + '0';
  if (!len)
    putchar('0');
  else
    while (len) putchar(buf[--len]);
}
inline void writesp(long long x) {
  write(x);
  putchar(' ');
}
inline void writeln(long long x) {
  write(x);
  putchar('\n');
}
long long val[(1 << 20) + 5], cnt[(1 << 20) + 5], ans[(1 << 20) + 5];
int a[200010];
char s[25][200010];
int n, m;
void fwt(long long* a, int n) {
  for (int k = 1; k < n; k <<= 1)
    for (int j = 0; j < n; j += (k << 1))
      for (int i = j; i < j + k; i++) {
        long long p = a[i], q = a[i + k];
        a[i] = p + q;
        a[i + k] = p - q;
      }
}
void ifwt(long long* a, int n) {
  fwt(a, n);
  for (int i = 0; i < n; i++) a[i] = a[i] / n;
}
int main() {
  n = read();
  m = read();
  for (int i = 0; i < n; i++) scanf("%s", s[i] + 1);
  for (int i = 1; i <= m; i++) {
    a[i] = 0;
    for (int j = 0; j < n; j++)
      if (s[j][i] == '1') a[i] |= (1 << j);
    ++cnt[a[i]];
  }
  val[0] = 0;
  for (int i = 1; i < 1 << n; i++) val[i] = val[i >> 1] + (i & 1);
  for (int i = 0; i < 1 << n; i++) val[i] = std::min(val[i], n - val[i]);
  fwt(val, 1 << n);
  fwt(cnt, 1 << n);
  for (int i = 0; i < 1 << n; i++) ans[i] = val[i] * cnt[i];
  ifwt(ans, 1 << n);
  long long mn = 1ll << 60;
  for (int i = 0; i < 1 << n; i++) mn = std::min(mn, ans[i]);
  writeln(mn);
  return 0;
}
