  For a family of sets $\mathcal{F}$, let
$\omega(\mathcal{F}):=\sum_{\{A,B\}\subset \mathcal{F}}|A\cap B|$. In this
paper, we prove that provided $n$ is sufficiently large, for any
$\mathcal{F}\subset \binom{[n]}{k}$ with $|\mathcal{F}|=m$,
$\omega(\mathcal{F})$ is maximized by the family consisting of the first $m$
sets in the lexicographical ordering on $\binom{[n]}{k}$. Compared to the
maximum number of adjacent pairs in families, determined by Das, Gan and
Subakov in 2016, $\omega(\mathcal{F})$ distinguishes the contributions of
intersections of different sizes. Then our results is a extension of Ahlswede
and Katona's results in 1978, which determine the maximum number of adjacent
edges in graphs. Besides, since
$\omega(\mathcal{F})=\frac{1}{2}\left(\sum_{x\in [n]}|\{F\in \mathcal{F}:x\in
F\}|^2-km\right)$ for $k$-uniform family with size $m$, our results also give a
sharp upper bound of the sum of squares of degrees in a hypergraph.
