#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()];
    if (distance_2(center, p) <= 1.0) 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 search(int rest_selected_count, int index, stack<int> selected_index,
            vector<Point> points, int size) {
  if (rest_selected_count == 0 || index == size) {
    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);
  search(rest_selected_count - 1, index + 1, selected_index, points, size);
  selected_index.pop();
  search(rest_selected_count, index + 1, selected_index, points, size);
}
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);
    }
    int count = search_count_tmp;
    for (int j = 2; j < n; ++j) {
      search_count_tmp = 1;
      stack<int> selected_index;
      search(j, 0, selected_index, points, n);
      if (search_count_tmp > count) {
        count = search_count_tmp;
      } else {
        break;
      }
    }
    cout << count << endl;
  }
  return 0;
}
