#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
using namespace std;

const double ESP = 1E-9;
double x[300];
double y[300];

int main(){
	int n;
	while(cin >> n && n){
		for(int i = 0; i < n; i++){
			char c;
			cin >> x[i];
			cin >> c;
			cin >> y[i];
		}
		int count = 1;
		for(int i = 1; i < n; i++){
			for(int j = 0; j < i; j++){
				double dx = x[j] - x[i];
				double dy = y[j] - y[i];
				double mx = (x[j]+x[i]) / 2;
				double my = (y[j]+y[i]) / 2;
				double dis = sqrt(dx*dx + dy*dy);
				if(dis > 2.0) continue;
				double mdis = dis / 2;
				double dis2 = sqrt(1-mdis*mdis);
				dx /= dis;
				dy /= dis;
				double px[2], py[2];
				px[0] = mx + dis2 * dy;
				px[1] = mx - dis2 * dy;
				py[0] = my - dis2 * dx;
				py[1] = my + dis2 * dx;
				for(int k = 0; k < 2; k++){
					int c = 0;
					for(int l = 0; l < n; l++){
						double dx2 = px[k] - x[l];
						double dy2 = py[k] - y[l];
						double dis3 = dx2 * dx2 + dy2 * dy2;
						if(dis3 < 1 + ESP) c++;
					}
					count = max(count, c);
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}