import std.stdio;
import std.string;
import std.conv;

void main() {
    
    for(;;) {
        
        // input
        int R, C;
        {
            auto temp = readln.split;
            R = to!int(temp[0]);
            C = to!int(temp[1]);
        }
        
        if(R == 0 && C == 0) {
            break;
        }
        
        bool[][] board;
        board.length = R;
        for(int i=0; i<R; ++i) {
            board[i].length = C;
        }
        
        for(int i=0; i<R; ++i) {
            auto temp = readln.split;
            for(int j=0; j<C; ++j) {
                board[i][j] = cast(bool) to!int(temp[j]);
            }
        }
        
        // calc
        int ret = 0;

        int rowsEnd = 1 << R;
        for(int rInt=0; rInt<rowsEnd; ++rInt) {
            
            int val;
            for(int i=0; i<C; ++i) {
                
                int temp;
                for(int j=0; j<R; ++j) {
                    
                    bool r = cast(bool) (rInt & (1 << j));
                    if(r != board[j][i]) {
                        ++temp;
                    }
                    
                }
                temp = temp > R - temp ? temp : R - temp;
                val += temp;
                
            }
            if(ret < val) {
                ret = val;
            }
            
        }

        writeln(ret);
    }
}