The Queen's Journey 1#5714

The Queen's Journey 1

1 second
16 megabytes
Easy

Given a sequence of squares on an 8 \times 8 chessboard, represented by consecutive coordinates of a queen in chess notation, determine how many distinct squares the queen visits during its journey.

A square is considered visited if it lies on any straight-line path of the queen's movement, even if it is not explicitly listed in the sequence.

Input

The input consists of a single line containing the sequence of squares where the queen was positioned during her journey. The input data is guaranteed to be correct.

Output

Output a single number representing the total number of distinct squares visited by the queen.

Examples

Example 1

Loading
Loading