@ magetips,
Your requirement can be simply done through the Magento admin. I have tested this in my local Magento-2.2.0 CE version.
To achieve this, go to the Admin => Marketing => Cart Price Rules
Enter the required fields for the Rule Information as follows,
Rule Name: Your desired rule name ,
Active: Yes
Website: Main Website (In my case it's only Main Website)
Customer Groups: (Choose the required customer groups)
Coupon: No Coupon
Under the Conditions tab, set the condition as,
Total Items Quantity is 3
Under the Actions tab,
Apply: Fixed amount discount for whole cart
Leave all the fields empty and under the tab labelled "Apply the rule only to cart items matching the following conditions (leave blank for all items)."
set Free Shipping: For matching items only
Please refer the attached screenshots.
Save the rule and clear the cache.