Why is the Median Less Sensitive to Extreme Values Compared to the Mean? I am sure we have all heard the following argument stated in some way or the other:

*

*For a given set of measurements (e.g. heights of students), the mean of these measurements is more "prone" to be influenced by outliers compared to the median of these same measurements.
Conceptually, the above argument is straightforward to understand. The median is not directly calculated using the "value" of any of the measurements, but only using the "ranked position" of the measurements. On the other hand, the mean is directly calculated using the "values" of the measurements, and not by using the "ranked position" of the measurements. Therefore, a statistically larger number of outlier points should be required to influence the median of these measurements - compared to influence of fewer outlier points on the mean. For example: the average weight of a blue whale and 100 squirrels will be closer to the blue whale's weight, but the median weight of a blue whale and 100 squirrels will be closer to the squirrels.
Using the R programming language, we can see this argument manifest itself on simulated data:
library(plotly)
    set.seed(123)


d = data.frame(data = rnorm(20, 5,50), col = "non outlier")

dd = data.frame(data = rnorm(5,150, 10), col = "outlier")

my_data = rbind(d,dd)

> mean(d$data)
[1] 10.08877

> median(d$data)
[1] 17.11447

We can also plot this to get a better idea:
d1 = data.frame(data = mean(my_data$data), col = "mean")
# add "1" to the median so that it becomes visible in the plot
d2 = data.frame(data = median(my_data$data) +1 , col = "median")

new_data = rbind(my_data, d1, d2)


plot_ly(type = "scatter", mode = "markers", data = new_data, x = ~data, y = " ", color = ~col ) %>% layout(title = 'Effect of Outliers on Median vs Mean')


My Question:  In the above example, we can see that the median is less influenced by the outliers compared to the mean - but in general, are there any "statistical proofs" that shed light on this inherent "vulnerability" of the mean compared to the median?
Apart from the logical argument of measurement "values" vs. "ranked positions" of measurements - are there any theoretical arguments behind why the median requires larger valued and a larger number of outliers to be influenced towards the extremas of the data compared to the mean?
I am aware of related concepts such as Cooke's Distance (https://en.wikipedia.org/wiki/Cook%27s_distance) which can be used to estimate the effect of removing an individual data point on a regression model - but are there any formulas which show some relation between the number/values of outliers on the mean vs. the median?
Are there any theoretical statistical arguments that can be made to justify this logical argument regarding the number/values of outliers on the mean vs. the median?

A reasonable way to quantify the "sensitivity" of the mean/median to an outlier is to use the absolute rate-of-change of the mean/median as we change that data point.  To that end, consider a subsample $x_1,...,x_{n-1}$ and one more data point $x$ (the one we will vary).  If we denote the sample mean of this data by $\bar{x}_n$ and the sample median of this data by $\tilde{x}_n$ then we have:
$$\begin{align}
\text{Sensitivity of mean}
&\equiv \bigg| \frac{d\bar{x}_n}{dx} \bigg|
= \frac{1}{n}, \\[12pt]
\text{Sensitivity of median (} n \text{ odd)}
&\equiv \bigg| \frac{d\tilde{x}_n}{dx} \bigg| 
= \mathbb{I}(x = x_{((n+1)/2)} < x_{((n+3)/2)}), \\[12pt]
\text{Sensitivity of median (} n \text{ even)}
&\equiv \bigg| \frac{d\tilde{x}_n}{dx} \bigg| 
= \frac{1}{2} \cdot \mathbb{I}(x_{(n/2)} \leqslant x \leqslant x_{(n/2+1)} < x_{(n/2+2)}). \\[12pt]
\end{align}$$
In the trivial case where $n \leqslant 2$ the mean and median are identical and so they have the same sensitivity.  In the non-trivial case where $n>2$ they are distinct.  In this latter case the median is more sensitive to the internal values that affect it (i.e., values within the intervals shown in the above indicator functions) and less sensitive to the external values that do not affect it (e.g., an "outlier").
