Finding the number of pairs in an integer Array
Overall it's very readable and fast already. Good job.

I have some suggestions for possible improvements:


As n must be equal to ar.size, you could drop that parameter from the method and use ar.size in place of n within the method body.
This method is a pure function except for the side effect of printing the result. Being a "pure function" is often a good thing so you can move the printing of the result to outside the method. Printing something is also quite time-consuming.
Your method could easily support more than Int, it doesn't have to be restricted by a specific type. You could check for duplicates of any type so we can make this method generic.
As you are iterating over elements you could use for (e in ar) instead of iterating over the indexes with for (i in 0 until n). This would make it more efficient for data structures that doesn't have a \$O(1)\$ lookup-time, for example LinkedList.
The method HashSet.add returns false if the value already exists, so you don't need the call to .contains.
There is a typo in the name enteries, it should be called entries.
ar could be called input to make it more readable.


After applying all of the above, this is what you would end up with:

fun &lt;T&gt; getNumberOfPairs(input: Array&lt;T&gt;): Int {
    val entries = HashSet&lt;T&gt;()
    var pairs = 0

    for (e in input) {
        if (!entries.add(e)) {
            pairs++
            entries.remove(e)
        }
    }
    return pairs
}