You're allowed to have two 'non family' members before your property is classified as an HMO, but when you get to three non-family, paying lodgers, it'll change. It doesn't matter if the lodgers are related to each other or not – the rule is around forming two or more separate households.
Do lodgers count as HMO?
If you have an owner-occupied property and share accommodation with one or two unrelated lodgers, this falls outside the HMO definition. However, owner occupied properties with three or more occupiers are classed as HMOs and may need to be licensed.
Who is exempt from HMO licensing?
Properties exempt from HMO licensing
a property occupied by two people living as two households (two-person flat shares) buildings managed or controlled by public sector bodies (such as the police or the NHS), the London Hostels Association or a registered social landlord.