Using HashSet I don't need to store array of size n.