#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void wrote(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) wrote(x / 10);
  putchar(x % 10 + '0');
}
inline void writeln(int x) {
  wrote(x);
  puts("");
}
const int N = 20;
int answ, n, m, f[N + 1][(1 << N) | 111], all;
char s[21][100010];
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; ++i) scanf("%s", s[i] + 1);
  for (int i = 1; i <= m; ++i) {
    int sz = 0;
    for (int j = 1; j <= n; ++j) sz = sz << 1 | (s[j][i] - '0');
    f[0][sz]++;
  }
  all = (1 << n) - 1;
  for (int v = 0; v <= n - 1; ++v)
    for (int k = n - 1; k >= 0; --k)
      for (int l = 0; l <= all; ++l) f[k + 1][l ^ (1 << v)] += f[k][l];
  answ = n * m;
  for (int v = 0; v <= all; ++v) {
    int ans = 0;
    for (int k = 0; k <= n; ++k) ans += min(k, n - k) * f[k][v];
    answ = min(answ, ans);
  }
  writeln(answ);
}
