The formula that relates the distance to the horizon (d) and the height of the observer above sea level (h) is derived from the geometry of the Earth, which is approximately spherical. The formula is:

where:
-
is the distance to the horizon,
-
is the height of the observer above sea level, and
-
is the radius of the Earth, which is approximately 3959 miles (or 6371 kilometers).
In this case, we know the distance to the horizon (7 miles) and we want to find the height of the observer (the height of the mast). So we can rearrange the formula to solve for \(h\):

Let's plug in the values and calculate the height.
The height of the mast, rounded to the nearest whole number, is approximately 33 feet.