#include <bits/stdc++.h>
struct point {
  double x;
  double y;
};
std::istream& operator>>(std::istream& s, point& p) {
  char c;
  return s >> p.x >> c >> p.y;
}
double getDistance(const point& a, const point& b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
int main(void) {
  int n;
  while (1) {
    std::cin >> n;
    if (n == 0) {
      break;
    }
    point o[100];
    for (int i = 0; i < n; i++) {
      std::cin >> o[i];
    }
    int counter = 0;
    for (double i = 0.0; i <= 10.0; i += 0.1) {
      for (double j = 0.0; j <= 10.0; j += 0.1) {
        point p;
        p.x = i;
        p.y = j;
        int counterTmp = 0;
        for (int k = 0; k < n; k++) {
          if (getDistance(p, o[k]) <= 1.0) {
            counterTmp++;
          }
        }
        if (counter < counterTmp) {
          counter = counterTmp;
        }
      }
    }
    std::cout << counter << std::endl;
  }
  return 0;
}
