On a 2D plane there are stones at given integer coordinates. A stone can be removed if it shares its row or column with another remaining stone. Return the maximum number of stones that can be removed. The input is JSON {stones}.
Input: JSON {stones}.
Output: Integer — the maximum stones removable.
Input: {"stones":[[0,0],[0,1],[1,0],[1,2],[2,1],[2,2]]}
Output: 5
Explanation: All but one can be removed.Input: {"stones":[[0,0],[0,2],[1,1],[2,0],[2,2]]}
Output: 3
Explanation: Two components leave two stones.Input: {"stones":[[0,0]]}
Output: 0
Explanation: A lone stone cannot be removed.1<=stones<=1000