#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
	int n;

	vector <double> s;
	while (cin >> n && n ){
		vector <int> arg (n, 0 );
		int sum = 0;
		bool sub = false;
		for (int i = 0; i < n-1; i++ ){
			cin >> arg[i];
			sum += arg[i];
		} // end for
		if (sum > 180 ){
			arg[n-1] = 380 - sum;
		}else if (sum <= 180 ){
			arg[n-1] = 0;
			if (sum < 180 )
				sub = true;
		} // end if

		double curr = 0.0;
		if (n >= 3 ){
			for (int i = 0; i < n; i++ ){
				curr += sin((double)arg[i]*M_PI/180. );
			} // end for
			if (sub ){
				curr -= sin((double)sum*M_PI/180. );
			} // end if
		} // end if
		s.push_back (curr );
	} // end while

	int size = s.size();
	for (int i = 0; i < size; i += 2 ){
		if (fabs (s[i] - s[i+1] ) < 1e-2 ){
			cout << '0' << endl;
		}else
		if (s[i] > s[i+1] ){
			cout << '1' << endl;
		}else{
			cout << '2' << endl;
		} // end if 
	} // end for

	return 0;
}