Well, I have a problem described in the title. Could someone help me with that problem?

My naive solution, which is O(n^2):

```
#include <iostream>
using namespace std;
int num;
long int array[100001]; long long int f[100001];
void Input(){
scanf("%d\n",&num);
array[0] = 0;
f[0] = 0;
for (int i = 1;i<=num;i++){
scanf("%d",&array[i]);
}
for (int i = 1;i<=num;i++){
f[i] = f[i-1]+array[i];
}
}
void XuLi(){
Input(); int counter = 0;
for (int j = 2;j<=num;j++){
for (int i = 1;i<j;i++){
if (f[i]==f[num]-f[j-1]) counter++;
}
}
printf("%d\n",counter);
}
int main(){
freopen("eseq.inp","r",stdin); freopen("eseq.out","w",stdout);
XuLi(); return 0;
}
```

Could someone have a better solution?