Rahul buys 16 cookies, Amit buys 12 cookies and Nayan buys x cookies. The average number of cookies the three bought is between 19 and 23, inclusive. What is the smallest number of cookies Nayan could have bought?