#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<double,double> P;

int main(){
	double eps = 10e-7;
	double x,y;
	int n;

	while(~scanf("%d",&n)){
		if(n==0) break;

		vector<P> base;
		int res=0;
		for(int i=0;i<n;i++){
			scanf("%lf,%lf",&x,&y);
			base.push_back(P(x,y));
		}
/*
		for(double y=0;y<10.0;y+=2.0){
			for(double x=0;x<10.0;x+=2.0){
				vector<P> now;
				for(int i=0;i<base.size();i++){
					if(x-3.0 <= base[i].first && base[i].first <= x+5.0
						&& y-3.0 <= base[i].second && base[i].second <= y+5.0){
							now.push_back(base[i]);
					}
				}
				
				for(int i=0;i<now.size();i++){
					int c=0;
					for(int j=0;j<now.size();j++){
						if(i==j) continue;
						double dist = sqrt(pow((now[i].first-now[j].first),2.0)+pow((now[i].second-now[j].second),2.0));
						printf("%f\n",dist);
						if(dist <= 2.0+eps){
							c++;
						}
					}

					res = max(res,c);
				}				
			}
		}
*/

		for(int i=0;i<base.size();i++){
					int c=1;
					for(int j=0;j<base.size();j++){
						if(i==j) continue;
						double dist = sqrt(pow((base[i].first-base[j].first),2.0)+pow((base[i].second-base[j].second),2.0));
						
						if(dist <= 2.0+eps){
							//printf("%f\n",dist);
							c++;
						}
					}

			res = max(res,c);
		}

		cout << res << endl;
	}
}