Count Function- look at multiple fields

Count Function- look at multiple fields

I want to put a limit on the number of campers that can sign up for one session.
Campers can sign up for up to three session. Let's call one of those camps "Open Age #1".
Open Age #1 could be selected in lookup one (Camp_Session_1), two (Camp_Session_2), or three (Camp_Session_3).

I've got my current code below that should check for records and alert if the limit is reached. It does not seem to work correctly. Can anyone spot my error?
Thanks!



max_people = 0;
if ((((input.Camp_Session_1  ==  "Open Age #1")  ||  (input.Camp_Session_2  ==  "Open Age #1"))  ||  (input.Camp_Session_3  ==  "Open Age #1"))  &&  (input.Male_or_Female1  ==  "Male"))
{
    max_people = 28;
}
if ((((input.Camp_Session_1  ==  "Open Age #1")  ||  (input.Camp_Session_2  ==  "Open Age #1"))  ||  (input.Camp_Session_3  ==  "Open Age #1"))  &&  (input.Male_or_Female1  ==  "Female"))
{
    max_people = 28;
}
if (count(Camper_Registration_Form[(((Camp_Session_1 == input.Camp_Session_1 || Camp_Session_2 == input.Camp_Session_1) || Camp_Session_3 == input.Camp_Session_1) && Male_or_Female1 == input.Male_or_Female1)])  >  max_people)
{
    waitlist = "Yes";
    alert("You have reached your camper limit for " + input.Camp_Session_1 + ". " + input.Camper_First_Name + " will be placed on the wait list.");
    input.Wait_List_Session_1 = waitlist;
}