#include <bits/stdc++.h>
using namespace std;
struct _Point {
  double x, y;
} point[110];
int edge[110][110];
bool used[110];
double sqr(double x) { return x * x; }
bool isoverlap(int i, int j) {
  return sqrt(sqr(point[i].x - point[j].x) + sqr(point[i].y - point[j].y)) <=
         2.0;
}
int dfs(int node, int cnt) {
  int ret = cnt;
  used[node] = true;
  for (int i = node - 1; i >= 0; i--)
    if (!used[i] && edge[node][i] > 0) {
      ret = max(ret, dfs(i, cnt + 1));
    }
  used[node] = false;
  return ret;
}
int main() {
  int n;
  while (scanf("%d", &n), n) {
    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)(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] = 1;
        }
      }
    }
    int ans = 0;
    for (int i = n - 1; i >= 0; i--) {
      ans = max(ans, dfs(i, 1));
    }
    printf("%d\n", ans);
  }
  return 0;
}
