require "pp"

def columns_test(rows)
  count = 0

  rows[0].size.times do |i|
    set_bits = 0

    rows.each do |row|
      set_bits += row[i]
    end

    count += [set_bits, rows.size - set_bits].max
  end

  count
end

def reverse(row)
  new_row = []

  row.each do |bit|
    new_row << (bit ^ 1)
  end

  new_row
end

def main_calc(rows)
  r = rows.size
  max = 0

  (0..(2 ** r)).each do |pattern|
    mask = 1
    new_rows = []

    rows.each do |row|
      new_row = []

      if (pattern & mask) == mask
        new_row = reverse(row)
      else
        row.each do |bit|
          new_row << bit
        end
      end

      new_rows << new_row
      mask <<= 1
    end

    if (count = columns_test(new_rows)) > max
      max = count
    end
  end

  max
end

loop do
  r, c = STDIN.readline.split(" ").map(&:to_i)
  break if r == 0 and c == 0

  rows = []
  r.times do
    rows << STDIN.readline.split(" ").map(&:to_i)
  end

  puts main_calc(rows)
end