Minimum Lines to Represent a Line Chart

From LeetCode. Collinear segments. Solve the geometry problem "Minimum Lines to Represent a Line Chart".

Examples
Input: [1,2,3]
Output: 0
Hints

Minimum Lines to Represent a Line Chart

**From LeetCode.** Collinear segments. Solve the geometry problem "Minimum Lines to Represent a Line Chart".