adding countTrees static method and catalan to verify the code.