How many $n$-element subsets $A$ of $\{1,2,3,\cdots,2n\}$ with specified sum are there?

Question:

Let $ n$ be an postive integer number.and let $A=\{x_{1},x_{2},\cdots,x_{n}\}$, How many $ n$-element subsets $ A$ of $ \{1,2,\dots,2n\}$ are there,such $$x_{1}+x_{2}+\cdots+x_{n}=\dfrac{n(2n+1)}{2},or,\dfrac{n(2n+1)}{3}$$

My idea:

if we Assmue that $f(n)$ is numbers of subset such this problem condition

if $n=1$,it is clear $A=\{1\}$ such so only one subsets such this condition.then $f(1)=1$

(2):if $n=2$,then $1+2+3+4=10=2\times 5$,so only two subsets $\{1,4\},\{2,3\}$such it then $f(2)=2$

(3): if $n=3$,then $1+2+3+\cdots+5+6=21=3\times 7$,then only one subsets such it $\{1,2,4\}$,then $f(3)=3$

but for general $n$,how can find this closed form $f(n)$

Now, Henning Makholm found if $n\equiv 5\pmod 6$,then $$f(n)=0$$

But other case,We can't know.

This problem is from:this


This question of mine is, I think, related:

How many different ways can the signs be chosen so that $\pm 1\pm 2\pm 3 ... \pm (n-1) \pm n = n+1$?

Since $1+2+...+(2n) =\frac12(2n)(2n+1) =(2n+1)n $, then if a subset sums to $\frac12 n(2n+1) $, the rest also sum to $\frac12 n(2n+1)(n+2) $ so the sum $\text{sum(original subset)-sum(others)} =0 $.

Therefore this is a choosing of signs for the integers from $1$ to $2n$ so their sum is zero.

For the second case, if the first sum is $\frac13 n(2n+1) $, the rest sum to $n(2n+1)-\frac13 n(2n+1) =\frac23 n(2n+1) $ so their difference is $\frac13 n(2n+1) $ and this does not have an obvious interpretation, unlike the first case.