#include <stdio.h>
#include <list>
#include <string.h>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;

#define SQ(x) ((x) * (x))
#define DIV (62800)

int n;
vector<int> G[100];
int degree[100];
int ans;
double s[DIV];
double c[DIV];

int main(void)
{
	double x[100], y[100];
	char use[100];
	int temp;
	
	for (int i = 0; i < DIV; i++){
		s[i] = sin((6.48 / DIV) * i);
		c[i] = cos((6.48 / DIV) * i);
	}
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		for (int i = 0; i < n; i++){
			scanf("%lf,%lf", &x[i], &y[i]);
		}
		
		ans = 0;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < DIV; j++){
				temp = 0;
				for (int k = 0; k < n; k++){
					if (SQ(x[i] + c[j] - x[k]) + SQ(y[i] + s[i] - y[k]) <= 4 && i != k){
						temp++;
					}
				}
				if (temp > ans){
					ans = temp;
				}
			}
		}
		
		printf("%d\n", ans);
	}
	
	return (0);
}