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.
import java.util.*;
import java.io.*;


public class Class{
    static DSU dsu;
    static RSQ t;
    static RMQ _t;
    static Heap h;
    final int INF = 1000000000;
    static int n;
    static TreeSet<Integer>d;
    static boolean used[];
    static ArrayList<Integer>gr[];
    static ArrayList<Integer>ans;
    static int dist[];
    static void dfs(int v){
            used[v] = true;
            ans.add(v);
        if(ans.size() == n)return;
        for (int i = 0; i < gr[v].size(); i++) {
            d.add(gr[v].get(i));
        }
        int t = d.pollFirst();
        while (used[t])t = d.pollFirst();
        dfs(t);
    }
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        char c[][] = new char[n][n];
        for (int i = 0; i < n; i++) {
            c[i] = in.next().toCharArray();
        }
        long ans = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if(c[i][j] == 'X'){
                    if(i == 0 || i == n-1 || j == 0 || j == n-1)continue;
                    if(c[i+1][j+1] == 'X' && c[i-1][j+1] == 'X' && c[i+1][j-1] == 'X' && c[i-1][j-1] == 'X')ans++;
                }
            }
        }
        System.out.println(ans);
        }
    void dijkstra(int st){
        boolean used[] = new boolean[n];
        TreeSet<Integer>q = new TreeSet<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return Integer.compare(dist[o1],dist[o2]);
            }
        });
        Arrays.fill(dist,INF);
        dist[st] = 0;
        q.add(0);
        while (!q.isEmpty()){
            int v = q.pollFirst();
            }
        }
    }

class RSQ{
    long a[];
    long t[];
    public RSQ(long[] a, long[]t) {
        this.a = a;
        this.t = t;
    }
    void build(int v, int tl, int tr){
        if(tl == tr)t[v] = a[tl];
        else{
            int tm = (tl+tr)/2;
            build(v*2,tl,tm);
            build(v*2+1,tm+1,tr);
            t[v] = t[v*2]+t[v*2+1];
        }
    }
    void update(int v, int tl, int tr, int pos, long val){
        if(tl == tr)t[v] = val;
        else{
            int tm = (tl+tr)/2;
            if(pos <= tm){
                update(v*2,tl,tm,pos,val);
            }else{
                update(v*2+1,tm+1,tr,pos,val);
            }
            t[v] = t[v*2]+t[v*2+1];
        }
    }
    long get(int v, int tl, int tr, int l, int r){
        if(tl > r || tr < l)return 0;
        if(l <= tl && r >= tr)return t[v];
        int tm = (tl+tr)/2;
        return get(v*2,tl,tm,l,r)+get(v*2+1,tm+1,tr,l,r);
    }
}
class RMQ{
    int []a ;
    int t[];
    public RMQ(int[] a, int t[]) {
        this.a = a;
        this.t = t;
        build(1,0,a.length-1);
    }
    void build(int v, int tl, int tr){
        if(tl == tr)t[v] = a[tl];
        else{
            int tm = (tl+tr)/2;
            build(v*2,tl,tm);
            build(v*2+1,tm+1,tr);
            t[v] = Math.min(t[v*2],t[v*2+1]);
        }
    }
    void update(int v,int tl, int tr, int pos, int val){
        if(tl == tr)t[v] = val;
        else{
            int tm = (tl+tr)/2;
            if(pos<=tm){
                update(v*2,tl,tm,pos,val);
            }else update(v*2+1,tm+1,tr,pos,val);
            t[v] = Math.min(t[v*2],t[v*2+1]);
        }
    }
    int get(int v, int tl, int tr, int l, int r){
        if(tr < l || tl > r)return Integer.MAX_VALUE;
        if(l <= tl && r >= tr)return t[v];
        int tm = (tl+tr)/2;
        return Math.min(get(v*2,tl,tm,l,r),get(v*2+1,tm+1,tr,l,r));
    }
}
class DSU{
    int par[];

    public DSU(int[] par) {
        this.par = par;
    }
    void make_set(int i){
        par[i] = i;
    }
    void union_sets(int a, int b){
      a = find_set(a);
      b = find_set(b);
      if(a!=b)par[a] = b;
    }
    int find_set(int a){
        if(par[a] == a)return a;
        else return par[a] = find_set(par[a]);
    }
}
class Heap {
    int[] h;
    int last;

    public Heap(int n) {
        h = new int[n];
        last = 1;
    }

    void siftUp(int i) {
        while (i / 2 > 0 && h[i] < h[i / 2]) {
            int t = h[i];
            h[i] = h[i / 2];
            h[i / 2] = t;
            i /= 2;
        }
    }

    void siftDown(int i) {
        int x = 2 * i;
        while (i != x && 2 * i < last) {
            x = i;
            if (i * 2 < last && h[x] > h[i * 2]) {
                x = 2 * i;
            }
            if (i * 2 + 1 < last && h[x] > h[i * 2 + 1]) {
                x = 2 * i + 1;
            }
            if (i != x) {
                int t = h[i];
                h[i] = h[x];
                h[x] = t;
                i = x;
                x = 2 * i;
            }
        }
    }
}
class Edge{
    int dir,w;
    public Edge(int dir, int w) {
        this.dir = dir;
        this.w = w;
    }
}
class P{
    int f, s;

    public P(int f, int s) {
        this.f = f;
        this.s = s;
    }
}
class C implements Comparator<Edge>{

    @Override
    public int compare(Edge o1, Edge o2) {
        return Double.compare(o1.w,o2.w);
    }
}