Counting number of bijections satisfying given inequality Given two sets $$A=\{a_{1},a_{2},\cdots,a_{m}\},B=\{b_{1},b_{2},\cdots,b_{m}\}$$ where 
$$a_{i}<b_{i}<a_{i+1}<b_{i+1},i=1,2,\cdots,m-1$$
and the function
$$g(a,b)=\begin{cases}
1&a>b\\
0&a\le b
\end{cases}$$
I'm expected to find the number of bijections
$f:A\to B$ satisfying the inequality
$$2\sum_{i=1}^{m}g(a_{i},f(a_{i}))>m$$
My attempt: We have 
$$a_{i}>f(a_{i})\,\Longrightarrow g(a_{i},f(a_{i}))=1$$
and 
$$a_{i}\le f(a_{i})\,\Longrightarrow g(a_{i},f(a_{i}))=0$$
and that's as far as I managed to get.
Thank you for your help.
 A: Note: The question is actually a generalized variant of the Tian Ji horse racing problem. A recent paper on Arxiv deals precisely with this question (the "winning" values). The approach presented below is slightly different.

First, let's simplify the terms a bit. The bijection $f:A\to B$ can be replaced by bijection $h:\{1,\ldots,m\}\to\{1,\ldots, m\}$ defined using relation $f(a_i)=b_{h(i)}$. Then, we can make the following observation:
$$g(a_i,f(a_i)) = 1 \Leftrightarrow a_i > f(a_i) \Leftrightarrow a_i > b_{h(i)} \Leftrightarrow i > h(i)$$
If $\mathcal{D}(h)$ denotes the number of values $1\leq i\leq m$ such that $h(i)<i$, we're looking for the number of permutations satisfying $\mathcal{D}(h)>m/2$. As it turns out (proof can be found in the article referenced above; it's not too difficult, though), the number of bijections $h$ having $D(h)=k$ is exactly equal to the Eulerian number
$$E(m,k)=\sum_{j=0}^k (-1)^j\binom{m+1}{j}(k+1-j)^m$$ Since Eulerian numbers have symmetry $E(m,k)=E(m,m-1-k)$ and their sum over all values of $k$ is equal to $m!$ (the total number of bijections on $m$ elements), we can evaluate the desired count as
$$\begin{eqnarray}
\sum_{k>m/2} E(m,k) & = & \frac{1}{2}\left(\sum_{k>m/2} E(m,k)+\sum_{k < (m/2)-1}E(m,k)\right) \\
& = & \frac{1}{2}\left(m! - \sum_{(m/2)-1\leq k \leq (m/2)} E(m,k)\right) \\
& = & \begin{cases}
\frac{1}{2}m! - E\left(m,\frac{m}{2}\right) & \mbox{for $m$ even}\\
\frac{1}{2}m! - \frac{1}{2}E\left(m,\frac{m-1}{2}\right) & \mbox{for $m$ odd}\\
\end{cases}
\end{eqnarray}$$
A: Just a partial solution for now.
A reformulation of the problem is the following:

Find the number of $\sigma\in S_m$ such that: 
  $$ 2\cdot\left|\{i\in [1,m]: i>\sigma(i)\}\right| > m.$$

We say that $c(\sigma) = \left|\{i\in [1,m]: i>\sigma(i)\}\right|$ is the charge of $\sigma$. 
Clearly, if we factor $\sigma$ into disjoint cycles $\rho_1,\ldots,\rho_k$, we have that the charge is additive:
$$ \sigma = \rho_1\cdot\ldots\cdot \rho_k,\qquad c(\sigma)=\sum_{i=1}^{k}c(\rho_i).$$
Moreover, it is trivial that the charge of a cycle is less than its length, $c(\rho_i)\leq l(\rho_i)-1,$ 
and that a cycle has maximum charge iff it can written in a decreasing form:
$$c\left((4,\;3,\;2,\;6,\;5)\right)=c\left((6,\;5,\;4,\;3,\;2)\right)=4.$$
By denoting as
$$ N(m) = \left|\{\sigma\in S_m: c(\sigma)>\frac{m}{2}\}\right| $$
we have $N(1)=N(2)=0,N(3)=N(4)=1,N(5)=27$. Moreover, if $\sigma$ is an involution ($\sigma^2=e$) we have $c(\sigma)\leq\frac{m}{2}$; on the other hand, if $\sigma$ has no fixed points, we have:
$$ c(\sigma)+c(\sigma^{-1}) = m, $$
so, if $m$ is odd, exactly one permutation between $\sigma$ and $\sigma^{-1}$ has a charge greater than $m/2$. 
Tris trivially gives:
$$ N(2k+1) \geq \left\lfloor\frac{(2k+1)!}{2e}\right\rfloor. $$
