#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
double x[105],y[105];
int n;
double calc_dist(int id,double s,double t)
{
	return sqrt((x[id]-s)*(x[id]-s)+(y[id]-t)*(y[id]-t));
}
int count(double s,double t)
{
	int res=0;
	for(int i=0;i<n;i++)
	{
		if(calc_dist(i,s,t)<=1.0)res++;
	}
	return res;
}
int main()
{
	while(1)
	{
		cin >> n;
		if(n==0)break;
		int ans=1;
		memset(x,0,sizeof(x));
		memset(y,0,sizeof(y));
		for(int i=0;i<n;i++)scanf("%lf,%lf",&x[i],&y[i]);
		for(double i=0.0;i<=10.0;i+=0.1)
		{
			for(double j=0.0;j<=10.0;j+=0.1)
			{
				ans=max(ans,count(i,j));
			}
		}
		cout << ans << endl;
	}
	return 0;
}