## Castle on the Grid

You are given a grid with both sides equal to . Rows and columns are numbered from to . There is a *castle* on the intersection (, ). In a single step you move from a point () to a point () if there is a straight horizontal line or a straight vertical line connecting these two and not containing any forbidden cell. Here, "*X*" denotes a forbidden cell.

Your task is to calculate the minimum number of steps it would take to move the *castle* from its initial position to the goal position ().

It is guaranteed that it is possible to reach the goal position from the initial position.

**Input Format**

The first line contains an integer , the size of the grid.

The following lines contains a string of length that consists of one of the following characters: "`X`

" or "`.`

". Here, "`X`

" denotes a forbidden cell, and "`.`

" denotes an allowed cell.

The last line contains , , denoting the initial position of the castle, and , , denoting the goal position. Here, , , and are space separated.

**Constraints**

**Output Format**

Output an integer denoting the minimum number of steps required to move the castle to the goal position.

**Sample Input**

```
3
.X.
.X.
...
0 0 0 2
```

**Sample Output**

```
3
```

**Explanation**

Here is a path that one could follow in order to reach the destination in steps:

.