#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);
}

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);

		set<int> crossSet[100];
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < n; ++j)
			{
				if (distance(x[i], y[i], x[j], y[j])-2 < 10e-6)
					crossSet[i].insert(j);
			}
		}

		int c;
		int left = n;
		bool cut[100];
		fill(cut, cut+n, false);
		for (c = 1; left != 0; ++c)
		{
			for (int j = 0; j < 2; ++j)
			for (int i = 0; i < n; ++i)
			{
				if (!cut[i] && crossSet[i].size() <= c)
				{
					cut[i] = true;
					--left;
					for (int j = 0; j < n; ++j)
						crossSet[j].erase(i);
				}
			}
			if (left == 0)
				break;
		}
		printf("%d\n", c);
	}

	return 0;
}