added logic to read text file and count inversions in it