#include <iostream>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


double dist(double x1,double y1,double x2,double y2){
	return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}
int main(void){

double tx[101],ty[101];
int n;
char k;
	
	while(cin >> n){
		if(n ==0 || cin.eof()) break;
		rep(i,n) cin >> tx[i] >> k >> ty[i];
		double ds[101][101];
		int cnt[101]={0};
		rep(i,n) rep2(j,i+1,n) ds[i][j] = dist(tx[i],ty[i],tx[j],ty[j]);
		rep(i,n) rep2(j,i+1,n) if(ds[i][j]<=2.0){ cnt[i]++; cnt[j]++; }
		int mx=0;
		rep(i,n) mx = max(mx,cnt[i]);
		cout << mx+1 << endl;
//		rep(i,n) rep2(j,i+1,n) if(ds[i][j]<=2.0)printf("%d:%d %f, ",i+1,j+1,ds[i][j]);
	}
	return 0;
	
}