#include <bits/stdc++.h>   const int N = 1 << 20;   int n, m, lim;   char s[22][100005];   int64_t a[N], b[N];   void fwt(int64_t* a, int f) {     for (int i = 1; i < lim; i <<= 1)       for (int j = 0; j < lim; j += i << 1)         for (int k = 0; k < i; ++k) {           int64_t x = a[j + k], y = a[j + k + i];           a[j + k] = x + y >> f;           a[j + k + i] = x - y >> f;         }   }   int main() {     scanf( %d%d , &n, &m);     lim = 1 << n;     for (int i = 0; i < lim; ++i)       b[i] = std::min(__builtin_popcount(i), n - __builtin_popcount(i));     for (int i = 0; i < n; ++i) {       scanf( %s , s[i]);       for (int j = 0; j < m; ++j) s[i][j] ^=  0 ;     }     for (int i = 0; i < m; ++i) {       int p = 0;       for (int j = 0; j < n; ++j) p |= s[j][i] << j;       ++a[p];     }     fwt(a, 0), fwt(b, 0);     for (int i = 0; i < lim; ++i) a[i] *= b[i];     fwt(a, 1);     std::cout << *std::min_element(a, a + lim) << std::endl;     return 0;   }   