Lunar New Year is approaching, and you bought a matrix with lots of "crosses".

This matrix M of size n × n contains only 'X' and '.' (without quotes). The element in the i-th row and the j-th column (i, j) is defined as M(i, j), where 1 ≤ i, j ≤ n. We define a cross appearing in the i-th row and the j-th column (1 < i, j < n) if and only if M(i, j) = M(i - 1, j - 1) = M(i - 1, j + 1) = M(i + 1, j - 1) = M(i + 1, j + 1) =  'X'.

The following figure illustrates a cross appearing at position (2, 2) in a 3 × 3 matrix.
    
    
      
    X.X  
    .X.  
    X.X  
    

Your task is to find out the number of crosses in the given matrix M. Two crosses are different if and only if they appear in different rows or columns.

Input

The first line contains only one positive integer n (1 ≤ n ≤ 500), denoting the size of the matrix M.

The following n lines illustrate the matrix M. Each line contains exactly n characters, each of them is 'X' or '.'. The j-th element in the i-th line represents M(i, j), where 1 ≤ i, j ≤ n.

Output

Output a single line containing only one integer number k — the number of crosses in the given matrix M.

Examples

Input


5
.....
.XXX.
.XXX.
.XXX.
.....


Output


1


Input


2
XX
XX


Output


0


Input


6
......
X.X.X.
.X.X.X
X.X.X.
.X.X.X
......


Output


4

Note

In the first sample, a cross appears at (3, 3), so the answer is 1.

In the second sample, no crosses appear since n < 3, so the answer is 0.

In the third sample, crosses appear at (3, 2), (3, 4), (4, 3), (4, 5), so the answer is 4.
#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  while (a && b)
    if (a > b)
      a %= b;
    else
      b %= a;
  return a + b;
}
template <class T>
void sortf(vector<T> &v) {
  stable_sort(v.begin(), v.end());
}
template <class T>
void sortb(vector<T> &v) {
  stable_sort(v.rbegin(), v.rend());
}
template <class T>
T max3(T a, T b, T c) {
  return max(a, max(b, c));
}
template <class T>
T min3(T a, T b, T c) {
  return min(a, min(b, c));
}
template <typename T>
istream &operator>>(istream &in, vector<T> &v) {
  for (T &t : v) in >> t;
  return in;
}
ostream &operator<<(ostream &out, const vector<char> &v) {
  for (const char &t : v) out << t;
  out << endl;
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  for (const T &t : v) out << t << ' ';
  return out;
}
static void init_iostream_speed() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
}
template <typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
template <class T>
void swap(T *a, T *b) {
  T c = *a;
  *a = *b;
  *b = c;
}
template <typename T>
class vector2 : public vector<T> {
 public:
  long long min_ind() {
    return min_element(this->begin(), this->end()) - this->begin();
  }
  long long max_ind() {
    return max_element(this->begin(), this->end()) - this->begin();
  }
  T min() { return *min_element(this->begin(), this->end()); }
  T max() { return *max_element(this->begin(), this->end()); }
  void sortf() { ::sortf(*this); }
  void sortb() { ::sortb(*this); }
  vector2() : vector<T>() {}
  vector2(vector<T> __v) : vector<T>(__v) {}
  vector2(initializer_list<T> __i_l) : vector<T>(__i_l) {}
  vector2(size_t __n, size_t __val = 0) : vector<T>(__n, __val) {}
};
template <class T>
T sum(const vector<T> &vc) {
  T ans = 0;
  for (const T &v : vc) ans += v;
  return ans;
}
long long nextInt() {
  long long t;
  cin >> t;
  return t;
}
long long nextLong() {
  long long t;
  cin >> t;
  return t;
}
constexpr long long MOD = 1000000007;
bool operator<<(const string &a, const string &b) {
  if (a == b) return true;
  if (a.size() != b.size()) return a.size() < b.size();
  return a < b;
}
long long intlen(long long x) {
  long long res = 1;
  while (x /= 10) res++;
  return res;
}
string operator*(const string &s, long long x) {
  string a;
  while (x--) a += s;
  return a;
}
long long factorial(long long x) {
  long long a = 1;
  for (long long i = 1; i <= x; i++) a *= i;
  return a;
}
template <class T>
T reverse(T o) {
  reverse(o.begin(), o.end());
  return o;
}
template <class T>
struct reader : public T {
  template <class... Con>
  reader(Con &&...par) : T(par...) {
    cin >> *this;
  }
};
template <>
class reader<long long> {
  long long x;

 public:
  reader() { cin >> x; }
  operator long long() { return x; }
};
class TaskAnswer {};
void answer() {
  cout << '\n';
  throw TaskAnswer();
}
template <class C, class... Ts>
void answer(C &&cur, Ts &&...args) {
  cout << cur;
  answer(args...);
}
class Answerer {
 private:
  ostream &out;
  void operator()() {
    out << '\n';
    throw TaskAnswer();
  }

 public:
  Answerer(ostream &os) : out(os) {}
  template <class C, class... Ts>
  void operator()(C &&cur, Ts &&...args) {
    out << cur;
    this->operator()(args...);
  }
};
vector<long long> pre_func(const string &s) {
  long long n = s.size();
  vector<long long> p(n);
  for (long long i = 1; i < n; i++) {
    long long j = p[i - 1];
    while (j > 0 && s[j] != s[i]) j = p[j - 1];
    if (s[i] == s[j]) j++;
    p[i] = j;
  }
  return p;
}
long long knut(const string &s, const string &t) {
  auto p = pre_func(s + '$' + t);
  long long n = s.size(), m = t.size();
  for (long long i = n + 1; i <= n + m; i++)
    if (p[i] == n) return i - n - 1;
  return -1;
}
class fastio {
 private:
  FILE *out = stdout;
  FILE *in = stdin;
  FILE *err = stderr;
  template <class T>
  void write(const T &val) {
    this->operator<<(val);
  }
  template <class T>
  void read(T &val) {
    this->operator>>(val);
  }
  template <class T>
  void error(const T &val) {
    this->operator<=(val);
  }

 public:
  fastio() {}
  ~fastio() {}
  fastio &operator>>(char *val) {
    scanf("%s", val);
    return *this;
  }
  fastio &operator<<(const char *val) {
    printf("%s", val);
    return *this;
  }
  fastio &operator<=(const char *val) {
    fprintf(this->err, "%s", val);
    return *this;
  }
  fastio &operator>>(long long &val) {
    scanf("%lld", &val);
    return *this;
  }
  fastio &operator<<(long long val) {
    printf("%lld", val);
    return *this;
  }
  fastio &operator>>(long &val) {
    scanf("%ld", &val);
    return *this;
  }
  fastio &operator<<(long val) {
    printf("%ld", val);
    return *this;
  }
  fastio &operator>>(short &val) {
    scanf("%hd", &val);
    return *this;
  }
  fastio &operator<<(short val) {
    printf("%hd", val);
    return *this;
  }
  fastio &operator>>(char &val) {
    scanf("%c", &val);
    return *this;
  }
  fastio &operator<<(char val) {
    printf("%c", val);
    return *this;
  }
  template <class T, class... AT>
  void write(const T &val, const AT &...args) {
    this->operator<<(val);
    this->write(args...);
  }
  template <class T, class... AT>
  void read(T &val, AT &...args) {
    this->operator>>(val);
    this->read(args...);
  }
  template <class T, class... AT>
  void error(const T &val, const AT &...args) {
    this->operator<=(val);
    this->error(args...);
  }
};
template <class T>
fastio &operator<<(fastio &out, const vector<T> &a) {
  for (const T &x : a) out << x << ' ';
  return out;
}
template <class T>
fastio &operator>>(fastio &in, vector<T> &a) {
  for (long long &x : a) in >> x;
  return in;
}
fastio console;
Answerer fanswer(cout);
mt19937 rnd(228);
inline void solve();
signed main() {
  init_iostream_speed();
  try {
    solve();
  } catch (TaskAnswer) {
  }
  cout.flush();
  return 0;
}
inline void solve() {
  long long n, ans = 0;
  cin >> n;
  vector<string> m(n);
  for (long long i = 0; i < (n); i++) cin >> m[i];
  for (long long i = 1; i < n - 1; i++)
    for (long long j = 1; j < n - 1; j++)
      ans += ((m[i][j] == 'X') && (m[i][j] == m[i - 1][j - 1]) &&
              (m[i][j] == m[i - 1][j + 1]) && (m[i][j] == m[i + 1][j - 1]) &&
              (m[i][j] == m[i + 1][j + 1]));
  cout << ans << '\n';
}
