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

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

inline bool is_overlap(DoublePair const& center1, DoublePair const& center2)
{
	return (
			(center1.first - center2.first) * (center1.first - center2.first) +
			(center1.second - center2.second) * (center1.second - center2.second)) <= 4;
}

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;
		}

		typedef std::vector<std::bitset<100>> OverlapDatas;
		OverlapDatas datas(n);
		for (std::size_t i = 0; i < centers.size(); ++i) {
			for (std::size_t j = 0; j < centers.size(); ++j) {
				if (is_overlap(centers[i], centers[j])) {
					datas[i].set(j, true);
				}
			}
		}

		std::size_t num_overlap = 0;
		for (auto const data : datas) {
			if (data.count() < num_overlap) {
				continue;
			}
			for (std::size_t i = 0, j = 0; i < data.count(); ++i, ++j) {
				while (data[j] == false) {
					++j;
				}
				if (datas[j].count() < num_overlap) {
					continue;
				}
				num_overlap = std::max((data & datas[j]).count(), num_overlap);
			}
		}
		std::cout << num_overlap << std::endl;
	}
	return 0;
}