
On a chessboard, a queen, a rook, and a knight of the same color are placed. How many squares on the board are under attack?
The rook (R) moves only horizontally and vertically, the knight (N) moves two squares in one direction and one in another (forming an "L" shape), and the queen (Q) moves horizontally, vertically, and diagonally. Note that the knight is the only chess piece that can jump over both its own and the opponent's pieces.
In the figure, red dots indicate squares attacked only by the queen, blue by the rook, and green by the knight. Yellow dots denote squares attacked by both the queen and rook, and brown dots by both the queen and knight.
A single line in international chess notation (see the sample input) gives the positions of the queen, knight, and rook (in any order), separated by spaces. All input data is valid.
Output a single number: the number of squares under attack.
Example 1