Count unique trees