There are three staple foods: 1 2 3.
In other words, there are 18 possibilities.
124/18 = 6+16, so at least seven students bought the same food and staple food.