Count Intersections

There's a line from (x1,y1) to (x2,y2) in a grid of squares of unit length. Write a program to compute the number of squares which are intersected by the line internally, i.e squares which are only touched by the line should not be counted.

Notes

Examples

1) Input (x1 y1 x2 y2): 1 1 6 6
Output (No. of squares): 5
2) Input: 1 1 7 6
Output: 10
3) Input: 1 1 7 5
Output: 8
4) Input: 5 6 500 6
Output: 0
5) Input: 1 200 180 2
Output: 376
6) Input: 1 10000 9999 173
Output: 19824