You will need to keep track of each crop.
Player plants the seed: +1 to the crop total
Player breaks the plant before the plant is ready to harvest: -1 to the crop total
Player harvests: no change in total
If you don't want automatic farms to count as the crop number, you can do this:
Player plants the seed: no change
Player breaks the plant before the plant is ready to harvest: no change
Player harvests: +1 to the crop total
If you want the player to PLANT and HARVEST, at the same time:
Player plants the seed: +1 to the variable of planted seeds
Player breaks the plant before the plant is ready to harvest: -1 to the variable of planted seeds
Player harvests: +1 to the crop total*
* Only allow the crop variable to have a number equal or lower to the seed variable. This way, a player can only raise the level by both planting and harvesting. Of course, this does not prevent a player from planting the seed (+1 to the variable of planted seeds) and harvesting a world generated plant in a village for example. But this would somewhat limit the total crop number variable, thus enabling control of the system.
If you just keep track of the crop number, without removing from the broken not fully grown crop, the player would abuse by planting and breaking to get the seed back and plant again.
You should lookup the docs for making this. Is not complicated.