#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdint>
#include <cmath>

typedef std::pair<double, double> DoublePair;

class is_overlap
{
	public:
		is_overlap(DoublePair const& center1)
			: center1_(center1) { }
		bool operator()(DoublePair const& center2) const
		{
			return (
					(center1_.first - center2.first) * (center1_.first - center2.first) +
					(center1_.second - center2.second) * (center1_.second - center2.second)) <= 4;
		}
	private:
		DoublePair const& center1_;
};

int main()
{
	std::uint16_t n;
	for (std::cin >> n; n != 0; std::cin >> n) {
		typedef std::vector<DoublePair> CenterVec;
		CenterVec centers(n);
		for (DoublePair& center : centers) {
			char comma;
			std::cin >> center.first >> comma >> center.second;
		}

		std::uint16_t max_num_overlap = 0;
		for (DoublePair const& center : centers) {
			std::uint16_t const num_overlap = std::count_if(
					centers.begin(), centers.end(), is_overlap(center));
			max_num_overlap = std::max(num_overlap, max_num_overlap);
		}

		std::cout << max_num_overlap << std::endl;
	}
	return 0;
}