You are given a grid of integer colours with rows rows and cols columns. A paint-bucket action starts at cell (sr, sc) and, moving only up/down/left/right, recolours that cell and every cell reachable from it through cells sharing the same original colour as the start cell, painting them all with newColor.
Report how many cells actually change value. If newColor equals the start cell's original colour, nothing changes and the answer is 0.
Input format
Line 1: two integers rows and cols.
The next rows lines each contain cols integers, the grid.
The final line contains three integers sr sc newColor (0-indexed cell and the new colour).
Output format
A single integer: the number of cells whose colour changes.
Constraints
- 1 <= rows, cols <= 50
- 0 <= every colour and newColor <= 20
- 0 <= sr <= rows - 1 and 0 <= sc <= cols - 1