Notice that the maximum sum of all elements can be at most . So, we can easily use Dynamic Programming to solve this problem.
Let be the number of subsequences with sum ended at or before the -th element. We either take the -th element for this subsequence of not take it. So the transition is .
Again, let be the number of subsequences with sum started from or after the -th element.
The transition for this case is .
So the number of subsequences with sum with the second equal part starting at the -th element is .
Solve this for all and and the summation of the results is the desired answer.