13
1 1 4 5 1 4 1 9 1 9 8 1 0
0 0 => 0 -1
0 0 => 1 0
0 0 1
1
0 3 => 0 -1
0 3 => 1 3
1 3 => 1 1
1 3 => 3 3
3 3 => 3 2
3 3 => 4 3
3 3 1
1 1 => 1 0
1 1 => 2 1
1 1 1
1 3 9
0 3 14
^C
bash-5.2$ ./A
1
13
1 1 4 5 1 4 1 9 1 9 8 1 0
0 12 => 0 6
0 12 => 10 12
10 12 => 10 9
10 12 => 11 12
11 12 => 11 10
11 12 => 12 12
12 12 => 12 11
12 12 => 13 12
12 12 0
11 12 1
10 12 9
0 6 => 0 2
0 6 => 4 6
4 6 => 4 4
4 6 => 6 6
6 6 => 6 5
6 6 => 7 6
6 6 1
4 4 => 4 3
4 4 => 5 4
4 4 1
4 6 9
0 2 => 0 1
0 2 => 3 2
0 1 => 0 -1
0 1 => 2 1
0 1=> 1 0
0 1 2
0 2 6
0 6 26
0 12=> 8 8
8 8 => 8 7
8 8 => 9 8
8 8 1
0 12 80
80