[Breakout Game] Counting Collisions

Hello everyone, I recently started learning how to code and how to game simple games in Unity. I watched the tutorial on how to make a simple Breakout game, and so far everything has been working fine. I added a few things to the game but I simply can’t get my head around this problem: How do I quantify the collisions? (I want to have different types of bricks, which are destroyed with X ammounts of collisions)
I thought it would be simple enough if I added a integer which is incremented everytime the ball hits the brick and then simply run ir through a IF statement to destroy the brick. Is this the right way to do it? Is there a better way? Can anyone point me in the right direction, please?
NOTE: Please don’t just give me a code already working, I would like the opportunity to learn.

For each block, you can use OnCollisionEnter.

Inside that method, decrease a counter. If the counter reaches zero, then destroy the block.

Pseudocode (script attached to block):

public int numberOfHitsLeft;

void OnCollisionEnter(Collision c) {
    // Optionally check that c.gameObject is the ball
    //     (not needed if you set the collision matrix and layers properly)

    // Decrease the number of hits left

    // If number of hits left < 1, Destroy this gameobject
}