#include <bits/stdc++.h>
using namespace std;
struct Point {
  double x;
  double y;
};
vector<Point> points;
double distance_2(Point p1, Point p2) {
  double d2 = (p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y);
  return d2;
}
Point calc_center(stack<int> selected_index, vector<Point> points) {
  stack<int> tmp_stack;
  Point center;
  double x = 0;
  double y = 0;
  int count = selected_index.size();
  while (!selected_index.empty()) {
    Point p = points[selected_index.top()];
    x += p.x;
    y += p.y;
    tmp_stack.push(selected_index.top());
    selected_index.pop();
  }
  while (!tmp_stack.empty()) {
    selected_index.push(tmp_stack.top());
    tmp_stack.pop();
  }
  center.x = x / count;
  center.y = y / count;
  return center;
}
int count_in_circle(Point center, stack<int> selected_index,
                    vector<Point> points) {
  stack<int> tmp_stack;
  int count = 0;
  while (!selected_index.empty()) {
    Point p = points[selected_index.top()];
    double d2 = distance_2(center, p);
    if (d2 <= 1.0 + 1e-9) count++;
    tmp_stack.push(selected_index.top());
    selected_index.pop();
  }
  while (!tmp_stack.empty()) {
    selected_index.push(tmp_stack.top());
    tmp_stack.pop();
  }
  return count;
}
int search_count_tmp = 1;
void combination(int rest_take_count, int take_count, int index,
                 stack<int>& selected_index, vector<Point>& points) {
  if (index == points.size()) {
    if (take_count != selected_index.size()) return;
    Point center = calc_center(selected_index, points);
    int count = count_in_circle(center, selected_index, points);
    if (count > search_count_tmp) {
      search_count_tmp = count;
    }
    return;
  }
  selected_index.push(index);
  combination(rest_take_count - 1, take_count, index + 1, selected_index,
              points);
  selected_index.pop();
  combination(rest_take_count, take_count, index + 1, selected_index, points);
}
int main() {
  int n;
  while (cin >> n) {
    if (n == 0) break;
    for (int i = 0; i < n; ++i) {
      Point p;
      scanf("%lf,%lf", &p.x, &p.y);
      points.push_back(p);
    }
    for (int j = 2; j <= n; ++j) {
      int count = search_count_tmp;
      stack<int> selected_index;
      combination(j, j, 0, selected_index, points);
      if (search_count_tmp == count) {
        break;
      }
    }
    cout << search_count_tmp << endl;
  }
  return 0;
}
