#C12284. Count Distinct Vertical Lines
Count Distinct Vertical Lines
Count Distinct Vertical Lines
You are given a set of points in a 2-dimensional plane, where each point is represented by its coordinates \( (x, y) \). A vertical line is defined by a fixed \( x \) coordinate. Your task is to determine the number of distinct vertical lines that can be formed which contain at least two points from the given set.
Formally, for a vertical line defined by \( x = k \), if there exist at least two points \( (k, y_1) \) and \( (k, y_2) \) in the set (\( y_1 \neq y_2 \) or even if they are the same, they are counted as multiple occurrences), then that vertical line is considered valid. The answer is the number of distinct \( x \) coordinates that have at least two points.
Note: A vertical line is counted only once regardless of how many points lie on it, as long as there are at least two points sharing the same \( x \)-coordinate.
inputFormat
The first line contains an integer \( n \) representing the number of points. Each of the next \( n \) lines contains two space-separated integers representing the \( x \) and \( y \) coordinates of a point.
If \( n = 0 \), it means there are no points.
outputFormat
Output a single integer which is the number of distinct vertical lines (i.e. distinct \( x \) coordinates with at least two points) that can be formed.
## sample5
1 2
1 3
2 1
2 4
3 5
2