Select some values from multiselect lookup

Select some values from multiselect lookup

Dear All,

I have a multiselect lookup which includes some values. 



 What deluge code should I write to select only 3 values? I mean, to limit the selection only to 3 values. If I try to select a 4th one, then I do not want to accept it.