#include <bits/stdc++.h>
using namespace std;
int Q[2001];
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, mx = 0, l = 0, r = 0;
  string str;
  cin >> n >> str;
  int xx = 0;
  for (auto ch : str) xx += ch == '(';
  if (xx != n - xx) {
    cout << mx << endl << l + 1 << " " << r + 1 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      if (str[i] == str[j] && (i > 0 || j > 0)) continue;
      swap(str[i], str[j]);
      deque<int> dq;
      int cnt = 0;
      for (int k = 1; k < 2 * n; k++) {
        if (str[(k - 1) % n] == '(')
          Q[k] = Q[k - 1] + 1;
        else
          Q[k] = Q[k - 1] - 1;
        while (!dq.empty() && dq.front() <= k - n) dq.pop_front();
        while (!dq.empty() && Q[dq.back()] >= Q[k]) dq.pop_back();
        dq.push_back(k);
        if (k - n >= 0) {
          if (Q[k] - Q[k - n] == 0 && Q[dq.front()] >= Q[k - n]) {
            ++cnt;
          }
        }
      }
      if (cnt > mx) {
        mx = cnt;
        l = i;
        r = j;
      }
      swap(str[i], str[j]);
    }
  }
  cout << mx << ' ' << endl << l + 1 << " " << r + 1 << endl;
}
