Let \textrm{MEX}(S, k) be the k-th positive integer in ascending order that is not present in S.
Denote \textrm{MEOW}(a) as the sum of \textrm{MEX}(b, |b| + 1) over all distinct subsets b of array a.
Given an array a of length n, consisting of 1,2,\dots, n. Determine the value of \textrm{MEOW}(a).
Consider a subset b of array a. Assume that the maximum value in b is m, and there are exactly x numbers < m that are not present in b. We have
\begin{gather*}
m - x = |b| \\
\textrm{MEX}(b, |b| + 1) = \textrm{MEX}(b, m - x + 1)
\end{gather*}
For convenience, let T = \operatorname{MEX}(b, m - x + 1). We now distinguish between two cases.
If |b| + 1 = m - x + 1 > x, i.e. m \ge 2x, then T > m holds, which implies that
\begin{aligned}
T = m + |b| + 1 - x = 2m - 2x + 1
\end{aligned}
Thus, for fixed m and x, their contribution to the final answer is
(2m - 2x + 1)\binom{m - 1}{x}
Otherwise, m < 2x, and T < m holds.
Since T is undetermined, we can simply enumerate all possible values of T from 1 to m - 1.
Consider the current T, which is the (m-x+1)-th integer that is not present. Hence, there are m-x integers \in [1, T) and 2x-m-1 integers \in (T, m) which are not present.
Thus, for fixed m and x, their contribution to the final answer is