#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

typedef complex<double> Point;
double EPS=1e-10;

int main()
{
	for(int n;cin>>n,n;){
		vector<Point> points;
		vector<int> nums;
		rep(i,n){
			Point p;
			scanf("%lf,%lf",&p.real(),&p.imag());
			
			bool unique=true;
			rep(j,points.size()){
				if(abs(points[j]-p)<EPS){
					nums[j]++;
					unique=false;
					break;
				}
			}
			if(unique){
				points.push_back(p);
				nums.push_back(1);
			}
		}
		
		vector<Point> ip;
		rep(i,points.size()){
			repi(j,i+1,points.size()){
				Point d=points[j]-points[i];
				if(abs(d)>2+EPS)
					continue;
				double t=acos(abs(d)/2);
				ip.push_back(points[i]+polar(1.0,arg(d)+t));
				ip.push_back(points[i]+polar(1.0,arg(d)-t));
			}
		}
		
		int res=0;
		rep(i,ip.size()){
			int temp=0;
			rep(j,points.size())
				if(abs(points[j]-ip[i])<1+EPS)
					temp++;
			res=max(res,temp);
		}
		
		cout<<res<<endl;
	}
	
	return 0;
}