#include <bits/stdc++.h>
using namespace std;
void init(int n, int* par, int* rank) {
  for (int i = 0; i < n; i++) {
    par[i] = i;
    rank[i] = 0;
  }
}
int find(int x, int* par, int* rank) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = find(par[x], par, rank);
  }
}
void unite(int x, int y, int* par, int* rank) {
  x = find(x, par, rank);
  y = find(y, par, rank);
  if (x == y) return;
  if (rank[x] < rank[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if (rank[x] == rank[y]) rank[x]++;
  }
}
bool same(int x, int y, int* par, int* rank) {
  return find(x, par, rank) == find(y, par, rank);
}
int main() {
  double eps = 10e-7;
  double x, y;
  int n;
  while (~scanf("%d", &n)) {
    if (n == 0) break;
    vector<pair<double, double> > base;
    int res = 0;
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &x, &y);
      base.push_back(pair<double, double>(x, y));
    }
    int* par = new int[n];
    int* rank = new int[n];
    init(n, par, rank);
    for (int i = 0; i < base.size(); i++) {
      for (int j = 0; j < base.size(); j++) {
        if (i == j) continue;
        double dist = pow((base[i].first - base[j].first), 2.0) +
                      pow((base[i].second - base[j].second), 2.0);
        if (dist <= 4.0) {
          unite(i, j, par, rank);
        }
      }
    }
    map<int, int> freq;
    for (int i = 0; i < base.size(); i++) {
      freq[find(i, par, rank)]++;
    }
    for (map<int, int>::iterator it = freq.begin(); it != freq.end(); it++) {
      res = max(res, it->second);
    }
    cout << res << endl;
    delete[] par;
    delete[] rank;
  }
}
