# -*- coding: utf-8 -*-

require 'pp'

class Array
  def sum
    self.inject(0) {|sum, elem| sum + elem}
  end
end

def gets_nums
  $stdin.gets.chomp.split(" ").map(&:to_i)
end

def read_each_lines(&proc)
  col, row = gets_nums
  return if col == 0 and row == 0
  proc.call(col.times.map {gets_nums}, col, row)
  read_each_lines(&proc)
end

read_each_lines do |board, col, row|
  result = (0..((1 << col) - 1)).map do |i|
    0.upto(row - 1).map do |r|
      zero_sum = 0
      0.upto(col - 1) do |c|
        zero_sum += 1 if ((i >> c) & 1) == board[c][r]
      end
      [zero_sum, (col - zero_sum)].max
    end.sum
  end.max
  puts result
end