#include <bits/stdc++.h>
using namespace std;
int max(int a, int b) {
  if (a >= b)
    return a;
  else
    return b;
}
int main() {
  int N, count = 0, max_c = 0;
  float x[101] = {}, y[101] = {};
  while (1) {
    count = 0;
    max_c = 0;
    cin >> N;
    if (N == 0) break;
    for (int i = 0; i < N; i++) {
      scanf("%f,%f", &x[i], &y[i]);
    }
    for (int i = 0; i < N; i++) {
      count = 0;
      for (int j = 0; j < N; j++) {
        if (sqrt((x[i] - x[j]) * (x[i] - x[j]) +
                 (y[i] - y[j]) * (y[i] - y[j])) <= 2.001) {
          count++;
        }
      }
      max_c = max(max_c, count);
    }
    cout << max_c << endl;
  }
  return 0;
}
