The rule of five a day is a rule of thumb. It makes good sense and it is easy to follow (assuming you can afford the food!)
Health fanatics love such rules, which makes some good sense, and love to raise the rules to the status of sacred principles, which makes very little sense.In general you will do well enough if you follow the rule comfortably with out going off half-cocked. Your body won't mind 4 1/2 one day and 5 1/2 the next! In fact your body is unlikely to notice whether you have four large or six small helpings. there is nothing magical about the number five.
As for multiple helpings of the same thing not counting, this makes no sense in the case of minor transgressions. In general a perfectly adequate rule is to aim for five a day of whatever is available; if it happens to be all onions or all cabbage it just happens to be a hard luck for anyone sharing the room with you.
Generally speaking, fresh plant material is a good source of various staple nutrients, and in particular is a good source of various vitamins and minerals, and presumably a sizeable number of chemicals not yet fully characterised, such as various antioxidants. It also contains various forms of roughage and is polluted with various microbes, both of which generally are good gut stimulants, although it is just too bad if they include for example harmful strains of Shigella.
The nice thing about varying the diet as much as possible is that no one plant material is a balanced food. By mixing them you improve your chance of getting as many of the nutrients that you need as possible, and avoiding irritating your gut with too much of any one material.
Eat, vary, and enjoy!
Jon