def catalan_rec_count(n, counter=1):
    if n <= 1:
        return 1, counter
res = 0
for i in range(n):
    partial1, inner_c1 = catalan_rec_count(i)
partial2, inner_c2 = catalan_rec_count(n - i - 1)
res += partial1 * partial2
counter += inner_c1 + inner_c2
return res, counter
Подсчет рекурсивных вызовов функции