A tree adapts to its environment and I would bet money that trees in their phenomenology can’t count.
Plants are much less adaptive than animals by definition. The problem isn’t whether they know numbers but how do you even test what plants “know”.
Since a tree has a much lower number of branches and leaves than there are photons, there has to be some aggregation of information involved in this computational process.