#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

struct Point{
	double x,y;
};

int main(){
	
	int n, ans, count;
	Point seal[100];
	
	while(cin >> n){
		if(n == 0) break;
		
		for(int i = 0; i < n; i++){
			scanf("%lf,%lf",&seal[i].x,&seal[i].y);
		}
		
		ans = -1;
		for(double i = 0; i <= 10; i += 0.1){
			for(double j = 0; j <= 10; j +=0.1){
				count = 0;
				for(int s = 0; s < n; s++){
					if(sqrt((i-seal[s].x)*(i-seal[s].x)+(j-seal[s].y)*(j-seal[s].y)) < 1 ||
							fabs(sqrt((i-seal[s].x)*(i-seal[s].x)+(j-seal[s].y)*(j-seal[s].y)) - 1) < 0.00000001){
						count++;
					}
				}
				if(ans < count) ans = count;
			}
		}
	
		cout << ans << endl;
	
	}
	
	return 0;
}

