import Control.Monad (replicateM)
import Data.Array (Array,listArray,(!))

type Row = Int
type Column = Int
type Table = [Array Int Bool]

main = do
    [nr,nc] <- getLine >>= (return . map read . words)
    if all (==0) [nr,nc] then return () else do
        t <- replicateM nr (getLine >>=
            return . listArray (1,nc) . map (=="1") . words)
        print $ solve nr nc t
        main

solve :: Row -> Column -> Table -> Int
solve nr nc t = maximum $ map (count nr nc t) (patterns nr)

count :: Row -> Column -> Table -> [Bool] -> Int
count nr nc t p = sum $ map countColumn [1..nc]
    where
    countColumn c = max u (nr-u)
        where
        u = length $ filter (==True) $ zipWith xor p (map (!c) t)

        xor True False = True
        xor False True = True
        xor _ _ = False

patterns :: Row -> [[Bool]]
patterns nr = map (pattern nr) [0..2^nr-1]
    where
    pattern 0 n = []
    pattern k n = (n `mod` 2 == 1) : pattern (k-1) (n `div` 2) 