def METHOD_NAME(domain, year, month):
    date_start, date_end = get_start_and_end_dates_of_month(year, month)
    users_existing_in_domain = set(
        doc['base_username']
        for doc in UserES().domain(domain)
        .web_users()
        .created(lte=date_end)
        .run().hits
    )
    users_who_accepted_invites = set(
        email
        for email in Invitation.objects.filter(
            domain=domain,
            is_accepted=True,
            invited_on__gte=date_start, invited_on__lt=date_end
        ).values_list('email', flat=True)
    )
    return len(users_existing_in_domain.union(users_who_accepted_invites))