Rook, knight and bishop#1122

Rook, knight and bishop

1 second
64 megabytes
Very easy

On a chessboard, a bishop, 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 along ranks and files, the knight (N) makes an 'L'-shaped move (two squares in one direction, one in another), and the bishop (B) moves along diagonals. By the way, the knight is the only chess piece that can jump over both its own and the opponent's pieces.

In the illustration, squares attacked only by the knight are marked with red dots, those attacked only by the rook with blue, and those attacked only by the bishop with green. Yellow dots indicate squares attacked simultaneously by both the knight and the rook.

Input

A single line contains the positions of the bishop, knight, and rook (in any order) separated by spaces, in international chess notation (see the sample input). All input data are valid.

Output

Output a single integer — the number of squares on the chessboard that are under attack by at least one of the pieces.

Examples

Example 1

Loading
Loading