To limit selection of checkboxes

Hi there

Does anyone know how to maintain a limit on the no. of checkboxes to be selected?
In my case, there are 8 checkboxes and user has to select any 4 of these.

Please reply.