A stockroom inventory is an R-by-C grid of integer bin levels, calibrated so that every row is sorted in non-decreasing order from left to right and every column is sorted in non-decreasing order from top to bottom (so the smallest level is at the top-left and the largest at the bottom-right).
Given a target level T, count how many bins hold exactly T.
Input format
Line 1: two integers R and C.
Next R lines: each contains C space-separated integers, forming a matrix that is non-decreasing along every row and down every column.
Final line: a single integer T, the target level.
Output format
A single integer: the number of entries equal to T.
Constraints
- 1 <= R, C <= 200
- -1000000000 <= each value, T <= 1000000000
- Every row is non-decreasing left to right; every column is non-decreasing top to bottom.