Assuming that your use of the absolute value notation represents cardinality (and not Lebesgue measure), your function $g(x)$ is the Banach indicatrix of the function $f.$ So what you're interested in is the (global) maximum value of the Banach indicatrix. Off-hand, I don't know of any nontrivial results connected with this specific aspect of the Banach indicatrix, but the Banach indicatrix is certainly a well known tool in real analysis and harmonic analysis.