#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pii = pair<int, int>;
using pll = pair<lint, lint>;
template <typename T>
using vc = vector<T>;
template <typename T>
using vvc = vector<vector<T>>;
template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
constexpr lint ten(int n) { return n == 0 ? 1 : ten(n - 1) * 10; }
class Task {
 public:
  int N;
  vc<int> sum, pre, suf;
  int check(string& s) {
    fill((sum).begin(), (sum).end(), 0);
    for (int i = (0); i < (N); ++i) {
      sum[i + 1] = sum[i];
      if (s[i] == '(')
        sum[i + 1]++;
      else
        sum[i + 1]--;
    }
    if (sum[N]) return 0;
    int res = 0;
    pre[0] = 0;
    for (int i = (1); i < (N + 1); ++i) pre[i] = min(pre[i - 1], sum[i]);
    suf[N] = 0;
    for (int i = N - 1; 0 <= i; --i) suf[i] = min(suf[i + 1], sum[i]);
    if (suf[0] == 0) ++res;
    for (int i = (1); i < (N - 1 + 1); ++i) {
      if (sum[i] <= pre[i] and sum[i] <= suf[i]) ++res;
    }
    return res;
  }
  void solve(istream& in, ostream& out) {
    in >> N;
    string S;
    in >> S;
    int ans = -1, a = -1, b = -1;
    sum.resize(N + 1, 0);
    suf.resize(N + 1, 0);
    pre.resize(N + 1, 0);
    for (int i = (0); i < (N); ++i)
      for (int j = (i); j < (N); ++j) {
        swap(S[i], S[j]);
        if (chmax(ans, check(S))) {
          a = i;
          b = j;
        }
        swap(S[i], S[j]);
      }
    out << ans << '\n';
    out << a + 1 << ' ' << b + 1 << '\n';
  }
};
int main() {
  istream& in(cin);
  ostream& out(cout);
  ios_base::sync_with_stdio(false);
  in.tie(nullptr), out.tie(nullptr);
  Task solver;
  solver.solve(in, out);
  return 0;
}
