import std.stdio;
import std.range;
import std.array;
import std.algorithm;
import std.string;
import std.conv;

void main(){
	auto inputs = readln.chomp.split.map!(to!int);
    bool[][] cards;
    cards.length = inputs[1];
    cards.each!((ref l){l.length = inputs[0]; l[] = true;});

    foreach(y; iota(0, cards.length)) {
        foreach(x; iota(0, cards[y].length)) {
            cards.flip(x.to!int,y.to!int);
        }
    }

    auto count = 0;
    iota(0,cards.length).each!((y){
        iota(0, cards[y].length).each!((x){
            if(!cards[y][x]){
                count++;
            }
        });
    });
    writeln(count);
}

void flip(ref bool[][] cards, int x, int y){
    iota(max(0,y-1), min(cards.length.to!int-1,y+1)+1)
        .each!((_y){
            iota(max(0, x-1),min(cards[_y].length.to!int-1,x+1)+1)
                .each!((_x){
                    cards[_y][_x] = !cards[_y][_x];
                });
        });
}