#include<stdio.h>
#include<math.h>

const double eps = 1e-10;

int main(void){
	
	int n;
	
	while(scanf("%d", &n), n){
		double x[128] = {0};
		double y[128] = {0};
		int is[128][128] = {0};
		for(int i = 0; i < n; i++){
			scanf("%lf,%lf", &x[i], &y[i]);
		}
		
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				double xx = x[i]-x[j];
				double yy = y[i]-y[j];
				if(i==j)continue;
				if(sqrt(xx*xx+yy*yy) <= 2+eps){
					is[i][j]=1;
				}
			}
		}
		int ans = 0;
		int a[128] = {0};
		
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				a[j] = is[i][j];
//				printf("%d-%d  ",i,j);
			}
			
			for(int j = 0; j < n; j++){
				if(a[j]){
					for(int k = 0; k < n; k++){
						if(j==k)continue;
						if(a[k] && !is[j][k]){
							a[k] = 0;
//							printf("%dx%d",j, k);
						}
					}
				}
			}
			
			int t = 0;
			for(int j = 0; j < n; j++)t+=a[j];
//			printf("t = %d\n", t);
			ans = t>ans?t:ans;
		}
		printf("%d\n", ans+1);
	}
	return 0;
}