Hi,
In that case, you need to use a custom plugin in order to authorize/modify the product quantity.
In the cart class, you will find a function _checkQuantity and a trigger near the end of that function
$dispatcher->trigger('onAfterProductQuantityCheck', array(&$product, &$wantedQuantity,&$quantity, &$cartContent, &$cart_product_id_for_product, &$displayErrors) );
That trigger allow you to dynamically adapt the product quantity ; you have access to the product (which is currently modified), the request quantity, the final quantity and also the full content of the current cart.
Regards,