A farmer distributed his bags of cabbages as follows:A certain hospital received a quarter of the total number of bags. A nearby school received half of the remainder. A greengrocer received athird of what the school received. What remained was six bags more than what the greengrocer received. How many bags of cabbages did the farmer have?