How to count the occurence of each element in map data structure

please explain the logic like for this input i want to count the occurence of x and y

1 1
2 3
3 5