#include <bits/stdc++.h>
using namespace std;
double dist(double x1, double y1, double x2, double y2) {
  return ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main(void) {
  double tx[101], ty[101];
  int n;
  char k;
  while (cin >> n) {
    if (n == 0 || cin.eof()) break;
    for (int i = 0; i < n; i++) cin >> tx[i] >> k >> ty[i];
    bool ds[101][101];
    int cnt[101] = {0};
    for (int i = 0; i < n; i++)
      for (int j = i + 1; j < n; j++)
        if (dist(tx[i], ty[i], tx[j], ty[j]) <= 4.0) {
          ds[i][j] = true;
          cnt[i]++;
          cnt[j]++;
        } else
          ds[i][j] = false;
    int mx = 0;
    for (int i = 0; i < n; i++) mx = max(mx, cnt[i]);
    int cmx = 0;
    if (mx > 0) {
      cmx = 1;
      for (int k = 0; k < n; k++) {
        vector<int> z;
        int ct2 = 0;
        if (cnt[k] <= cmx) continue;
        for (int i = 0; i < n; i++)
          if (ds[k][i] && i != k) z.push_back(i);
        for (int i = 0; i < n; i++)
          if (ds[i][k] && i != k) z.push_back(i);
        z.push_back(k);
        sort(z.begin(), z.end());
        z.erase(unique(z.begin(), z.end()), z.end());
        int ct1 = z.size();
        for (int i = 0; i < ct1; i++)
          for (int j = i + 1; j < ct1; j++)
            if (ds[z[i]][z[j]]) ct2++;
        for (int i = 0; i < cnt[k] + 1; i++)
          if (ct2 >= i * (i + 1) / 2 && i > cmx) {
            cmx = i;
          }
      }
    }
    cout << cmx + 1 << endl;
  }
  return 0;
}
