Form: Setting a variable-length array of fields

Mautic version: 4

I want to ask this information in a form:

  1. Number of invitees you are willing to bring to an event
  2. Your data: Name, Lastname, email, phone, age
  3. Invitee’s data: FOR EACH invitee: Name, and if they are adult/child.

I want for example if Alice comes with Bob (his husband) and Charlie and Dan, their kids, to enter this:

Section 1:
Invitees appart from you: 3

Section 2:
Name: Alice
Last Name: Smith
Phone: 666 666 666
Age: 28

Section 3:
Invitee1_Name: Bob
Invitee1_Kid: no
Invitee2_Name: Charlie
Invitee2_Kid: yes
Invitee3_Name: Dan
Invitee3_Kid: yes

But if you don’t bring more invitees, hide those fields.
Or if you bring, say, 10 invitees, 10 sets of 2 fields (name + kid) are automatically created.

How can I do this?