recursion code counting down and counting up
Look at the definition of your countdown function. 

If I call countdown (5), then it prints "before: n = 5", then it does lots of stuff including lots of printing, then it prints "after: n = 5" and finishes. So your output must start with "before: n = 5" and it must end with "after: n = 5" and all kinds of things might happen in between. 

And that's exactly what happens.