#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

#define NMAX 100
#define SQMAX 10

struct S{
	double x, y, r;
};

/*点と円 true->点は円の内部*/
bool po_cr(double cx, double cy, double cr, double px, double py){
    return pow((cx - px), 2.0) + pow((cy - py), 2.0) <= pow(cr, 2.0);
}


int main(){

	int n;
	int cnt, ans;
	S seal[NMAX];
	char gav;

	while(1){

		cin >> n;
		if(n == 0) break;

		for(int i = 0; i < n; i++){
			cin >> seal[i].x >> gav >> seal[i].y;
			seal[i].r = 1.0;
		}

		ans = 0;
		for(int i = 0; i < 100; i++){
			for(int j = 0; j < 100; j++){
				cnt = 0;
				for(int k = 0; k < n; k++){
					if(po_cr(seal[k].x, seal[k].y, seal[k].r, (double)SQMAX*i/100, (double)SQMAX*j/100)){
						cnt++;
					}
				}
				ans = max(ans, cnt);
			}
		}

		cout << ans << endl;

	}
}