Let the shopkeeper buy x number of books.
According to the given condition, cost of x books = Rs. 80
Therefore cost of each book = Rs. 80/x
Again, when he had bought 4 more books, then total number of books in this case = x + 4
So, cost of each book in this case = Rs. 80/x+4
According to the question,
Cost of each book in first case - cost of each book in second case = 1 Rupee
80/x - 80/x+4 = 1
80(x+4) - 80x / x(x+4) = 1
x^2 + 20x - 16x - 320 = 0
(x - 16)(x + 20) = 0
x = 16 or x = -20
Hence, the shopkeeper bought 16 books.