adding and time loops

I am new to programing and have a few questions. First what I want to do, when a button is pressed I want to start a 60 second program that will have to send a serial command to a video player, and make a digital pin high. After the 60 seconds I need it to count how many switches are closed, send another serial command based on how many switches are closed, wait 5 seconds turn the pin back to low, play a serial command to change the video and wait for someone to push the start button to start it all over again.

What I don't know is how can I do the adding of the switches? I am using a Mega and plan on having 30-40 switches.

Mega has 54 IO, yes?
Set them up with internal pullup resistors enabled.
Read the state of each, add 1 to a counter for each one that is closed to Gnd (reads back as low).
Put all the pins in an array:

byte pinsArray[] = {2,3,4,5,6, ...39, 40, 41,}; // whatever you use
byte lowCount;

in setup:
for (x=0; x<=41; x=x+1){
pinMode (pinsArray[x], INPUT_PULLUP);
}

in loop:
lowCount = 0;
for (x=0; x<=41; x=x+1){
  if (digitalRead(pinsArray[x]) == LOW){
  lowCount = lowCount +1;
  }
}

Piece of cake.