#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
const long long inf = 1e17 + 10;
using namespace std;
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long c = 0, ans = 0, x = 0, y = 0;
  for (char ch : s) {
    c += (ch == '(' ? 1 : -1);
  }
  if (c) {
    cout << 0 << "\n" << 1 << " " << 1 << '\n';
    return 0;
  }
  for (long long k = 0; k < n; k++) {
    for (long long j = k; j < n; j++) {
      swap(s[k], s[j]);
      stack<pair<char, long long>> st;
      for (long long i = 0; i < n; i++) {
        if (st.empty()) {
          st.push({s[i], i});
        } else {
          if (s[i] == '(') {
            st.push({s[i], i});
          } else {
            if (st.top().first == '(') st.pop();
          }
        }
      }
      long long e = -1, f = -1, sum = 0;
      while (!st.empty()) {
        f = st.top().second;
        if (st.top().first == ')')
          break;
        else
          e = st.top().second;
        st.pop();
      }
      long long cnt = 1;
      if (e == -1) {
        e = n, f = -1, cnt = 0;
      }
      for (long long i = e - 1; i > f; i--) {
        sum += (s[i] == '(' ? 1 : -1);
        if (sum == 0) cnt++;
      }
      if (cnt > ans) {
        ans = cnt;
        x = k, y = j;
      }
      swap(s[k], s[j]);
    }
  }
  cout << ans << '\n';
  cout << x + 1 << " " << y + 1 << '\n';
  return 0;
}
