Question: This is my first code in python and i completely can't get why the code in 5-th string must contain `math.sqrt(i))+1` instead of just `math.sqrt(i)`, because otherwise squares of prime numbers are added to the result.  

How to solve this is the easiest and most natural way? Thanks you all in advance

```
import math
n=int(input("Print n: "))
prime_list=list(range(2,n))
for i in range(2,n):
    for j in range (2, math.ceil(math.sqrt(i))+1):
        if i % j == 0:
            try:
                prime_list.remove(i)
            except:
                j+=1
        continue

print(prime_list)

```

Answer: 
No, HashMap does not provide this capability out-of-the-box.

However, you could use two different approaches to achieve the goal:

A) If the number of orders in each state does not need to be checked that often, simply iterate over `map.values()` and count the amount of orders in each state

B) If the number of orders is very large, or state needs to be checked often, each time you add a new order or update its state, increment a counter for the new state and decrement the counter for the old state.
You can put your values into a `Set` to get uniques, then count occurrences of each element with `Collections.frequency`:

```
Set<String> singles = new HashSet<>(map.values());

for(String element : singles) {
    System.out.println(element + ": " + Collections.frequency(map.values(), element));
}

```