The upper and lower fences define the interval on which a data value isn't considered an outlier. In this case, if the element has a value less that the lower fence [18], then its an outlier; and if the element has a value greater than the upper fence [30], then it is an outlier.

In your data set, only two values are considered outliers. The first is 16 because it has a value less than the lower fence [18]. The second is 31 because it has a value greater than the upper fence [30].

The numbers 18 and 30 have nothing to do with the number of elements, but it deals with the value of the elements.