#include <iostream>
#include <complex>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <string>
#define EPS 1e-10
#define EQ(a,b) (abs(a - b) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()))
using namespace std;

typedef complex<double> P;

int main ()
{
    double x, y;
    int n;
    while (cin >> n, n) {
        vector<P> V;
        string str;
        while (cin >> str, --n) {
            stringstream ss;
            for (int i = 0; i < str.size(); i++)
                if (str[i] == ',') str[i] = ' ';
            ss << str;
            ss >> x >> y;
            V.push_back(P(x,y));
        }

        int res = 0;
        for (auto i : V) {
            int count = 1;
            for (auto j : V) {
                if (i != j) {
                    if (abs(i-j) - 2.0 < 0.0) count++;
                }
            }
            res = max(res, count);
        }
        cout << res << endl;
    }

    return 0;
}