class Solution {
public:
int trees(int x,int y)
{
int way = 1;
if (x<y)
{
way = 0;
for (int i = x; i <=y; i++)
{
way += trees(x, i-1) * trees(i+1, y);
}
}
return way;
}
int numTrees(int n) {
return trees(1,n);
}
};