#K70647. Minimum Friendship Circles
Minimum Friendship Circles
Minimum Friendship Circles
You are given an array of non-negative integers. Each integer represents a characteristic of a friend. Two friends having the same integer can be grouped into one friendship circle. Your task is to determine the minimum number of friendship circles that can be formed. In other words, you need to count the number of distinct elements in the array.
Mathematically, if the array is represented as \( A = [a_1, a_2, \ldots, a_n] \), then the answer is \( |\{ a_i : 1 \leq i \leq n \}| \). Note that if the array is empty, the output should be 0
.
inputFormat
The input is given via standard input (stdin). The first line contains an integer \( n \) (\(0 \leq n \leq 10^5\)) representing the number of elements in the array. If \( n > 0 \), the second line contains \( n \) space-separated non-negative integers.
outputFormat
Output a single integer to standard output (stdout) representing the minimum number of friendship circles.
## sample9
3 3 3 2 2 2 1 1 4
4