Have a look into the following extension: https://www.woocommerce.com/products/table-rate-shipping/ – that’ll allow you to set up shipping conditions based on the contents of the cart.
I think you’ll need a plugin for that charging formula. There are a few shipping plugins around if you search.
If you want to use the core WooCommerce plugin, You’ll need to modify your requirements. You can use a formula for flat rate, something like:
4 + ( 1.5 * [qty] )
You would need to adjust the numbers so that, overall, your shipping costs are covered.
Formula evaluation runs on a basic calculator, so ifs, less-thans and more-thans for example are not available.