#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> Point;

const double EPS = 1e-8;
const double PI = atan(1.0) * 4.0;

struct Data
{
	double arg;
	bool in;
	Data(double arg, bool in) : arg(arg), in(in) {}
	bool operator< (const Data& d)const
	{
		return fabs(arg - d.arg) < EPS ? in && !d.in : arg < d.arg;
	}
};

int main()
{
	int n;
	while(scanf("%d", &n), n){
		vector<Point> p(n);
		rep(i, n){
			scanf("%lf,%lf", &p[i].real(), &p[i].imag());
		}

		int ans = 0;
		rep(i, n){
			int sim = 1;
			vector<Data> args;
			rep(j, n){
				if(i == j)
					continue;
				Point vec = p[j] - p[i];
				double r = abs(vec);

				if(r > 2.0)
					continue;
				else if(r < EPS){
					++sim;
				}else{
					double theta = atan2(vec.imag(), vec.real());
					double phi = acos(r/2.0);

					double a = theta - phi;
					if(a < -PI) a += 2.0 * PI;
					double b = theta + phi;
					if(b > PI) b -= 2.0 * PI;
					args.push_back(Data(a, true));
					args.push_back(Data(b, false));

					if(b < a)
						++sim;
				}
			}
			sort(args.begin(), args.end());
			int best = sim;
			//printf("%d --\n", i+1);
			rep(i, args.size()){
			//	printf("sim = %d\n", sim);
				if(args[i].in)
					++sim;
				else
					--sim;
				best = max(best, sim);
			}
			//printf("sim = %d\n", sim);
			ans = max(best, ans);
		}

		printf("%d\n", ans);
	}
	return 0;
}