I am using AEM (5.6)
1) Go to Siteadmin
2) Then browse to the Tools Section (if you have cq deployed on your local machine and if author instance is deployed on port 4502) then the URL would be http://localhost:4502/miscadmin
3) In tools section browse to Versioning and see purge, once you will click there you will see a screen shot as shown below.
4) Specify the maximum number of version that you want to keep and then click on dry run to be sure before everything is purged.