#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
inline void getint(int &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
inline void print(int first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int a[101010], f[21][1 << 20];
char s[101010];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    for (int j = 0; j < m; j++) a[j] |= (s[j] - '0') << i;
  }
  for (int i = 0; i < m; i++) f[0][a[i]]++;
  for (int i = 0; i < n; i++) {
    for (int j = n; j; j--) {
      for (int k = 0; k < 1 << n; k++) f[j][k] += f[j - 1][k ^ (1 << i)];
    }
  }
  int ans = n * m;
  for (int i = 0; i < 1 << n; i++) {
    int mid = 0;
    for (int j = 0; j <= n; j++) mid += min(j, n - j) * f[j][i];
    smin(ans, mid);
  }
  cout << ans << endl;
  return 0;
}
