#include <bits/stdc++.h>
using namespace std;
double x[100], y[100];
int lap_num[100];
int laps[100][100];
inline int lap(double x1, double y1, double x2, double y2) {
  return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) <= 4.0 ? 1 : 0;
}
int main() {
  int N;
  while (cin >> N) {
    if (N == 0) break;
    for (int i = 0; i < N; i++) {
      scanf("%lf,%lf\n", &x[i], &y[i]);
    }
    for (int i = 0; i < N; i++) {
      for (int j = i; j < N; j++) {
        laps[i][j] = lap(x[i], y[i], x[j], y[j]);
        laps[j][i] = laps[i][j];
      }
    }
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        lap_num[i] += laps[i][j];
      }
    }
    int m = 0;
    for (int i = 0; i < N; i++) {
      m = max(m, lap_num[i]);
    }
    cout << m << endl;
  }
  return 0;
}
