#include <bits/stdc++.h>
using namespace std;
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int INF = 1e9 + 10;
const ll INF_LL = 1e18 + 10;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template <class T, class U>
void chmin(T &x, const U &y) {
  x = min<T>(x, y);
}
template <class T, class U>
void chmax(T &x, const U &y) {
  x = max<T>(x, y);
}
using P = complex<double>;
const double PI = acos(-1.0);
const double EPS = 1e-6;
int n;
P p[100];
int main() {
  while (cin >> n, n) {
    for (ll i = (0); i < (ll)(n); i += (ll)1) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      p[i] = P(x, y);
    }
    int mx = 0;
    for (ll i = (0); i < (ll)(n); i += (ll)1)
      for (ll j = (0); j < (ll)(101); j += (ll)1)
        for (ll k = (0); k < (ll)(50); k += (ll)1) {
          P q = p[i] + polar(j * 0.01, k * PI / 50);
          int c = 0;
          for (ll l = (0); l < (ll)(n); l += (ll)1)
            c += abs(p[l] - q) < 1.0 + EPS;
          chmax(mx, c);
        }
    cout << mx << endl;
  }
}
