Create an Admin and each user can create max 3 sub users under him

Hi Guys, I am creating an API where user can register as Admin and each Admin can have max 3 users under him. how can I set the limit of 3users?

over one years old but i have a similar requirement… not sure yet how to achieve this