Ugh. I remember this pow. I was just looking at my writeup, to see if it might be helpful for you, but I think I got the answer wrong. For five switches, I got 21 (?). Here are the equations I made for x number of switches...maybe even though they're not right they'll help you out. I don't know, but it's all I've got.
If you have an odd number of switches...
Number of moves required =
number of moves required for last odd number of switches * 4 +1.
For even numbers I found an explicit rule:
Number of moves required = 2 ^(x-1) + (x-2)
BTW, I hated hated hated IMP, and now that I'm in calc I feel like it's kind of screwed me over in terms of math knowledge. I don't know though, because some people I know like it. What do you think?