var $counter =
    // map up to 1, down to -1
    $up.map(function () { return 1; }).merge($down.map(function () { return -1; }))
    .scan(0, function(x,y) { return Math.max(MIN_VALUE, x + y); })
    .startWith(0);