#include<iostream>
#include<vector>
#include<string>
#include<cmath>


using namespace std;

int d[400][400] = {};
int _d[11][11] = {};
int dp[1 << 11][11] = {};
int n;

int rec(int s, int v) {
    if(dp[s][v] >= 0) {
        return dp[s][v];
    }

    if(s == (1<<n) - 1 && v== 0) {
        return dp[s][v];
    }

    int res = 500000;
    for(int u = 0; u < n; u++) {
        if(!(s >> u & 1)) {
            res = min(res, rec(s | 1<<u, u) + _d[v][u]);
        }
    }
    return dp[s][v] = res;
}

int main() {
    while(true) {
        string c[20];
        int w,h;
        cin >> w >> h;
        if(w == 0 && h == 0) {
            break;
        }
        for(int i = 0; i < h; i++) {
            cin >> c[i];
        }

        int size = w*h;

        for(int i = 0; i < size; i++) {
            for(int j = 0; j < size; j++) {
                int ix = i%w, iy = i/w, jx = j%w, jy = j/w;
                if(i == j) d[i][j] = 0;
                else if(abs(ix - jx) +abs(iy - jy) == 1 && c[iy][ix] != 'x' && c[jy][jx] != 'x') d[i][j] = 1; 
                else d[i][j] = 50000; 
            }
        }
        for(int k = 0; k < size; k++) {
            for(int i = 0; i < size; i++) {
                for(int j = 0; j < size; j++) {
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }

        vector<int> v;
        int rob;
        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w; j++) {
                if(c[i][j] == 'o') rob = j + (i*w);
                if(c[i][j] == '*') v.push_back(j + (i*w));
            }
        }

        bool unreached = false;

        for(int i = 0; i < v.size(); i++) {
            if(d[rob][v[i]] >= 50000) {
                cout << -1 << endl;
                unreached = true;
                break;
            }
            _d[0][i+1] = d[rob][v[i]];
            for(int j = 0; j < v.size(); j++) {
                _d[i+1][j+1] = d[v[i]][v[j]];
            }
        }
        if(unreached) {
            continue;
        }

        n = v.size() + 1;
        for(int i = 0; i <(1 << n); i++) {
            for(int j = 0; j < n; j++) {
                dp[i][j] = -1;
            }
        }

        cout << rec(0,0)+1 << endl;


    }

}
