#include <iostream>
#include <cstdio>
#include <algorithm>
int main(){
	int n;
	while(std::cin >> n, n){
		double circle[100][2];
		int olaps[100] = {0};
		for(int i=0;i<n;i++){
			scanf("%lf,%lf", &circle[i][0], &circle[i][1]);
		}

		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				double xinc = circle[i][0] - circle[j][0],
					yinc = circle[i][1] - circle[j][1],
					dis = xinc * xinc + yinc * yinc;
				if(dis <= 4)olaps[i]++, olaps[j]++;
			}
		}

		int res = 0;
		for(int i=0;i<n;i++){
			res = std::max(res, olaps[i]);
		}

		std::cout << res + 1 << std::endl;
	}
}