#include <bits/stdc++.h>
using namespace std;
int n, m, dp[25][1100000], ans = 1e9;
char num[25][100005];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) scanf("%s", num[i] + 1);
  for (int i = 1; i <= m; ++i) {
    int t = 0;
    for (int j = 1; j <= n; ++j) t = t * 2 + num[j][i] - '0';
    ++dp[0][t];
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < 1 << n; ++j) {
      for (int k = 1; k < 1 << n; k <<= 1)
        dp[i][j] = dp[i][j] + dp[i - 1][j ^ k];
      if (i >= 2) dp[i][j] = dp[i][j] + (i - 2 - n) * dp[i - 2][j];
      dp[i][j] /= i;
    }
  for (int i = 1; i < 1 << n; ++i) {
    int t = 0;
    for (int j = 0; j <= n; ++j) t += min(j, n - j) * dp[j][i];
    ans = min(ans, t);
  }
  cout << ans << endl;
  return 0;
}
