#include <bits/stdc++.h>
using namespace std;
struct _Point {
  double x, y;
} point[110];
int edge[110][110];
int memo[110];
bool used[110];
double sqr(double x) { return x * x; }
bool isoverlap(int i, int j) {
  return sqr(point[i].x - point[j].x) + sqr(point[i].y - point[j].y) <= 4.0;
}
int main() {
  int n;
  while (scanf("%d", &n), n) {
    vector<vector<int> > vv;
    for (int i = (0); i < (int)(110); i++)
      for (int j = (0); j < (int)(110); j++) edge[i][j] = 0;
    for (int i = (0); i < (int)(110); i++) memo[i] = 0;
    for (int i = (0); i < (int)(n); i++) {
      scanf("%lf,%lf", &point[i].x, &point[i].y);
      for (int j = (0); j < (int)(i); j++) {
        if (isoverlap(i, j)) {
          edge[i][j] = edge[j][i] = 1;
        }
      }
    }
    for (int i = (0); i < (int)(n); i++) {
      int m = vv.size();
      for (int j = (0); j < (int)(m); j++) {
        int k;
        for (k = 0; k < vv[j].size() && edge[i][vv[j][k]] > 0; k++)
          ;
        if (k == vv[j].size()) {
          vector<int> tmp = vv[j];
          tmp.push_back(i);
          vv.push_back(tmp);
        }
      }
      vector<int> tmp(1, i);
      vv.push_back(tmp);
    }
    int ans = 0;
    for (int i = (0); i < (int)(vv.size()); i++) {
      ans = max(ans, (int)vv[i].size());
    }
    printf("%d\n", ans);
  }
  return 0;
}
