#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;

double distance(double x1, double y1, double x2, double y2)
{
	double dx = x1-x2;
	double dy = y1-y2;
	return sqrt(dx*dx+dy*dy);
}

double distance_between_point_line(double x, double y, double a, double b, double c)
{
	return abs(a*x + b*y + c) / sqrt(a*a+b*b);
}

int main()
{
	while (true)
	{
		int n;
		scanf("%d", &n);
		if (n == 0)
			break;

		double x[100];
		double y[100];
		for (int i = 0; i < n; ++i)
			scanf("%lf,%lf", x+i, y+i);

		int ans = 1;
		for (int i = 0; i < n-1; ++i)
		{
			for (int j = i+1; j < n; ++j)
			{
				double a, b, c;
				a = x[i] - x[j];
				b = y[i] - y[j];
				c = -(x[i]*x[i]-x[j]*x[j] + y[i]*y[i]-y[j]*y[j]) / 2;
				double r = 1;

				vector<pair<double, double> > cross;
				double d = distance_between_point_line(x[i], y[i], a, b, c);
				if (d > r)
					continue;

				double for_unit = sqrt(a*a+b*b);
				double cx, cy;
				cx = (x[i]+x[j])/2;
				cy = (y[i]+y[j])/2;

				double h = sqrt(r*r - d*d);
				int sign[] = { 1, -1 };
				for (int k = 0; k < 2; ++k)
				{
					double xx = cx + sign[k] * h*b/for_unit;
					double yy = cy + sign[k] * h*-a/for_unit;
					cross.push_back(make_pair(xx, yy));
				}

				if (cross.size() != 0 && ans < 2)
					ans = 2;
				vector<int> counter;
				for (int k = 0; k < cross.size(); ++k)
					counter.push_back(2);

				for (int k = 0; k < n; ++k)
				{
					if (k == i || k == j)
						continue;

					for (int l = 0; l < cross.size(); ++l)
					{
						if (distance(cross[l].first, cross[l].second, x[k], y[k]) - 1.0 < 1e-6)
							++counter[l];
					}
				}
				for (int k = 0; k < counter.size(); ++k)
					ans = max(ans, counter[k]);
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}