What is the output for this testcase?

6 is the answer.