------
## 最终结论
```python
def numTrees(n: int) -> int:
    # Create a list to store the number of unique BSTs for each count of nodes
    dp = [0] * (n + 1)
    # There is one unique BST for zero nodes and one node
    dp[0], dp[1] = 1, 1

    # Fill the dp array using the Catalan number formula
    for nodes in range(2, n + 1):
        for root in range(1, nodes + 1):
            left_trees = dp[root - 1]      # Number of unique BSTs with left subtree
            right_trees = dp[nodes - root] # Number of unique BSTs with right subtree
            dp[nodes] += left_trees * right_trees

    return dp[n]

# Example usage:
print(numTrees(3))  # Output: 5
```