#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <random>
#include <cstdlib>
#include <cmath>
#include <sstream>

#define INF (1<<21)
#define swap(a,b) {a=a+b; b=a-b; a=a-b;}
#define min(a,b) {a > b ? b:a}
#define max(a,b) {a > b ? a:b}
using namespace std;
void q90() {
	int n;
	for (; cin >> n;) {
		if(!n) break;
		vector < pair<double, double > > seals;
		for (int i = 0; i < n; i++) {
			double x, y;
			scanf("%lf,%lf", &x, &y);
			seals.push_back(make_pair(x,y));
		}
		int max = 0;
		for (auto i = seals.begin(); i != seals.end(); i++) {
			int overlap = 0;
			for (auto j = seals.begin(); j != seals.end(); j++) {
				if (pow((*i).first - (*j).first, 2) + pow((*i).second - (*j).second, 2) <= 4.0) {
					overlap++;
				}
			}
			if (max < overlap) swap(max, overlap);
		}
		cout << max << endl;
	}
}

int main() {
	q90();
	return 0;
}