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

using namespace std;

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

typedef struct {
	int index;
	int degree;
} SORTDATA;

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

int check(char use[] , int depth)
{
	char next[100];
	int next_count;
	
	if (depth > ans){
		ans = depth;
	}
	
	memset(next, 1, sizeof(next));
	
	next_count = n;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < depth; j++){
			if (G[use[j]][i] == 0 && next[i] == 1){
				next[i] = 0;
				next_count--;
			}
		}
	}
	
	if (next_count == 0){
		return (0);
	}
	
	for (int i = 0; i < n; i++){
		if (next[i] == 1 && degree[i] > ans - 1){
			use[depth] = i;
			check(use, depth + 1);
		}
	}
	
	return (0);
}

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;
				}
			}
		}
		
		SORT_DATA sort_data[100];
		for (int i = 0; i < n; i++){
			degree[i] = 0;
			for (int j = 0; j < n; j++){
				degree[i] += G[i][j];
			}
		}
		
		char use[100];
		memset(use, 0, sizeof(use));
		ans = 1;
		for (int i = 0; i < n; i++){
			use[0] = i;
			check(use, 1);
		}
		printf("%d\n", ans);
	}
	
	return (0);
}