#include <bits/stdc++.h>
using namespace std;
int n;
double x[101], y[101], a[101][101];
int dfs(int x, int d) {
  int res = 1;
  for (int i = x + 1; i < n; i++) {
    if (a[x][i] <= 2) {
      if (!d)
        res = max(res, dfs(i, d + 1));
      else
        res += dfs(i, d);
    }
  }
  return res;
}
int main() {
  while (cin >> n, n) {
    for (int i = 0; i < n; i++) scanf("%lf,%lf", &x[i], &y[i]);
    memset(a, 0, sizeof(a));
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        a[i][j] =
            sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
    int ans = 0;
    for (int i = 0; i < n; i++) ans = max(ans, dfs(i, 0));
    cout << ans << endl;
  }
}
