#include <iostream>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(int argc, char **argv)
{
	int n, t;
	float **a, *x, *y;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		a = (float **)calloc(n+1, sizeof(float));
		x = (float *)calloc(n+1, sizeof(float));
		y = (float *)calloc(n+1, sizeof(float));
		for(int i = 0; i < n; i++){
			a[i] = (float *)calloc(n+1, sizeof(float));
			scanf("%f,%f", &x[i], &y[i]);
		}
		
		for(int i = 0; i < n; i++){
			for(int j = i+1; j < n; j++){
				a[i][j] = a[j][i] = sqrt(((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])));
			}
			a[i][i] = 5.0;
		}
		t = 0;
		
		for(int i = 0, s = 1; i < n; i++, s = 1){
			for(int j = 0; j < n; j++){
				if(a[i][j] <= 2.0 && i != j){
					s++;
				}
			}
			if(t < s){
				t = s;
			}
			free(a[i]);
		}
		cout << t << endl;
		free(a);
		free(y);
		free(x);
	}
	
	return 0;
}