#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

struct Point {
    double x;
    double y;
};

vector<Point> points;

double distance(Point p1, Point p2) {
    double d2 = (p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y);
    double d = abs(sqrt(d2));
    return d;
}

Point calc_center(vector<int> selected_index, vector<Point> points) {
    Point center;
    double x = 0;
    double y = 0;
    int count = 0;
    for(int i : selected_index) {
        Point p = points[i];
        x += p.x;
        y += p.y;
        count++;
    }
    center.x = x / count;
    center.y = y / count;
    return center;
}

int count_in_circle(Point center, vector<Point> points) {
    int count = 0;
    for(Point p : points) {
        if(distance(center, p) <= 1.0) count++;
    }
    return count;
}

int search_count_tmp = 1;

void search(int lest_selected_count, vector<int> selected_index, vector<Point> points, int size) {
    if(lest_selected_count == 0) {
        Point center = calc_center(selected_index, points);
        int count = count_in_circle(center, points);
        if(count > search_count_tmp) {
            search_count_tmp = count;
        }
        return;
    }

    for (int i = 0; i < size; ++i) {
        vector<int> copy_index(selected_index.size());
        copy(selected_index.begin(), selected_index.end(), copy_index.begin());
        copy_index.push_back(i);
        search(lest_selected_count - 1, copy_index, points, size);
    }
}


int main() {
    int n;
    while (cin >> n) {
        if(n == 0) break;
        int max_count = 0;
        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;
            vector<int> selected_index;
            search(j,  selected_index, points, n);
            if (search_count_tmp > count) {
                count = search_count_tmp;
            } else {
                break;
            }
        }
        cout << count << endl;
    }

    return 0;
}