#include <bits/stdc++.h>
using namespace std;
int n;
double x[101], y[101];
bool is_intersected(int i, int j) {
  return ((x[i] - x[j]) * (x[i] - x[j])) + ((y[i] - y[j]) * (y[i] - y[j])) <
         ((1 + 1) * (1 + 1));
}
int main() {
  while (cin >> n, n) {
    for (int i = (0); i < (n); i++) {
      char ch;
      cin >> x[i] >> ch >> y[i];
    }
    int ans = 0;
    for (int i = (0); i < (n); i++) {
      int buf = 0;
      for (int j = (0); j < (n); j++)
        if (is_intersected(i, j)) buf++;
      ans = max(ans, buf);
    }
    cout << ans << endl;
  }
  return 0;
}
