#include <iostream>
#include <vector>
#include <string>
#include <tuple>

void solve() {
    int n;
    std::cin >> n;

    std::vector<int> win(n, 0);
    std::vector<std::pair<int, int>> ps;
    for (int x = 0; x < n; ++x) {
        for (int y = 0; y < n; ++y) {
            char c;
            std::cin >> c;
            if (x >= y) continue;

            if (c == 'o') {
                ++win[x];
            } else if (c == 'x') {
                ++win[y];
            } else if (c == '-') {
                ps.emplace_back(x, y);
            }
        }
    }

    int m = ps.size();

    int ans = n;
    for (int b = 0; b < (1 << m); ++b) {
        auto nwin = win;

        for (int i = 0; i < m; ++i) {
            int x, y;
            std::tie(x, y) = ps[i];

            if ((b >> i) & 1) {
                ++nwin[x];
            } else {
                ++nwin[y];
            }
        }

        int cnt = 1;
        for (int x = 1; x < n; ++x) {
            if (nwin[x] > nwin[0]) ++cnt;
        }

        ans = std::min(ans, cnt);
    }

    std::cout << ans << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}