```
int numTrees(int n) {
long long result=1;
for(int i=n+1;i<=2*n;i++){
result = (result * i)/(i-n);
}
return result/(n+1);
}
```

The total number of possible tree's is given by the formula (2n)!/(n+1)!*n! which is called the Catalan number. Read more about it here.