#include <bits/stdc++.h>
using namespace std;
constexpr long long MAXN = 128;
char a[MAXN];
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int st = 1; st <= n; st++) {
    for (int jump = 1; jump <= n; jump++) {
      int cnt = 0;
      for (int i = st; i <= n; i += jump) {
        if (a[i] == '.') break;
        cnt++;
        if (cnt == 5) return cout << "YES\n", false;
      }
    }
  }
  return cout << "NO\n", false;
}
