#include <fstream>
#include <algorithm>
#include <unordered_map>

using namespace std;

#define maxN 200

ifstream input("Bai2_15.inp");
ofstream output("Bai2_15.out");
int n;
int arr[maxN];

int maxLen()
{
	unordered_map<int, int> presum;

	int sum = 0;
	int max_len = 0;

	for (int i = 0; i < n; i++)
	{
		sum += arr[i];

		if (arr[i] == 0 && max_len == 0)
			max_len = 1;
		if (sum == 0)
			max_len = i + 1;

		if (presum.find(sum) != presum.end())
		{
			max_len = max(max_len, i - presum[sum]);
		}
		else
		{
			presum[sum] = i;
		}
	}

	return max_len;
}

int main()
{
	input >> n;
	for (int i = 0; i < n; ++i)
	{
		input >> arr[i];
	}
	int res = maxLen();
	if (res == 0)
	{
		output << "NO SOLUTION";
	}
	else
	{
		output << res;
	}
	input.close();
	output.close();
	return 0;
}