import
java.util.*;
class
GFG
{
static
class
Node {
int
key;
Node next;
};
static
Node push(Node head_ref,
int
new_key)
{
Node new_node =
new
Node();
new_node.key = new_key;
new_node.next = (head_ref);
(head_ref) = new_node;
return
head_ref;
}
static
int
countMinimum( Node head)
{
HashMap<Integer,Integer> mp =
new
HashMap<Integer,Integer>();
Node current = head;
while
(current !=
null
)
{
int
data = current.key;
mp.put(data, (mp.get(data) ==
null
?
1
:mp.get(data) +
1
));
current = current.next;
}
current = head;
int
min_frequency = Integer.MAX_VALUE, countMin =
0
;
for
(Map.Entry<Integer,Integer> it :mp.entrySet())
{
if
(it.getValue() <= min_frequency)
{
min_frequency = it.getValue();
}
}
for
(Map.Entry<Integer,Integer> it :mp.entrySet())
{
if
(it.getValue() == min_frequency)
{
countMin += (it.getValue());
}
}
return
countMin;
}
public
static
void
main(String args[])
{
Node head =
null
;
int
x =
21
;
head = push(head,
10
);
head = push(head,
30
);
head = push(head,
11
);
head = push(head,
10
);
head = push(head,
10
);
System.out.println( countMinimum(head) );
}
}