#include <bits/stdc++.h>
using namespace std;
const int INF = ~0U >> 1;
char s[20][100000 + 10];
int dp[21][1 << 20];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", &s[i]);
  for (int j = 0; j < m; j++) {
    int x = 0;
    for (int i = 0; i < n; i++)
      if (s[i][j] == '1') x |= 1 << i;
    dp[0][x]++;
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j >= 1; j--)
      for (int k = 0; k < (1 << n); k++) dp[j][k] += dp[j - 1][k ^ (1 << i)];
  int ans = INF;
  for (int i = 0; i < (1 << n); i++) {
    int cur = 0;
    for (int j = 0; j <= n; j++) cur += dp[j][i] * min(j, n - j);
    ans = min(ans, cur);
  }
  cout << ans << endl;
  return 0;
}
