#include <stdio.h>
#include <list>
#include <string.h>

using namespace std;

#define SQ(x) ((x) * (x))

int n;
char G[100][100];

int check(int n)
{
	int count;
	int result;
	bool loopflag;
	bool chflag;
	
	result = 0;
	do {
		loopflag = false;
		result++;
		do {
			chflag = false;
			for (int i = 0; i < n; i++){
				count = 0;
				for (int j = 0; j < n; j++){
					count += G[i][j];
				}
				if (count > 0){
					loopflag = true;
				}
				if (count <= result){
					for (int j = 0; j < n; j++){
						if (G[i][j] == 1){
							chflag = true;
						}
						G[i][j] = G[j][i] = 0;
					}
				}
			}/*
			for (int i = 0; i < n; i++){
				for (int j = 0; j < n; j++){
					printf("%d ", G[i][j]);
				}
				puts("");
			}
			puts("");*/
		} while (chflag == true);
	} while (loopflag == true);
	
	return (result);
}

int main(void)
{
	double x[100], y[100];
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		memset(G, 0 , sizeof(G));
		
		for (int i = 0; i < n; i++){
			scanf("%lf,%lf", &x[i], &y[i]);
		}
		
		for (int i = 0; i < n; i++){
			for (int j = i + 1; j < n; j++){
				if (SQ(x[i] - x[j]) + SQ(y[i] - y[j]) <= 4.0){
					G[i][j] = G[j][i] = 1;
				}
			}
		}
		/
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				printf("%d ", G[i][j]);
			}
			puts("");
		}
		
		puts("");*/
		printf("%d\n", check(n));
	}
	
	return (0);
}