#include <bits/stdc++.h>
using namespace std::chrono;
using namespace std;
const int mod = 1e9 + 7;
string s;
int op[501], cl[501];
int sop[501], scl[501];
int n;
void f() {
  memset(op, 0, sizeof(op));
  memset(cl, 0, sizeof(cl));
  if (s[0] == '(')
    op[0]++;
  else
    cl[0]++;
  memset(sop, 0, sizeof(sop));
  memset(scl, 0, sizeof(scl));
  if (s[n - 1] == '(')
    sop[n - 1]++;
  else
    scl[n - 1]++;
  for (int i = n - 2; i >= 0; --i) {
    if (s[i] == ')') {
      sop[i] = sop[i + 1];
      scl[i] = scl[i + 1] + 1;
    } else {
      if (scl[i + 1]) {
        sop[i] = sop[i + 1];
        scl[i] = scl[i + 1] - 1;
      } else {
        sop[i] = sop[i + 1] + 1;
        scl[i] = scl[i + 1];
      }
    }
  }
  for (int i = 1; i < n; ++i) {
    if (s[i] == '(') {
      op[i] = op[i - 1] + 1;
      cl[i] = cl[i - 1];
    } else {
      if (op[i - 1]) {
        op[i] = op[i - 1] - 1;
        cl[i] = cl[i - 1];
      } else {
        op[i] = op[i - 1];
        cl[i] = cl[i - 1] + 1;
      }
    }
  }
}
void solve() {
  cin >> n;
  cin >> s;
  int x1 = 1, x2 = 1, mx = 0, c = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      int c = 0;
      swap(s[i], s[j]);
      f();
      for (int k = 0; k < n; ++k) {
        int open;
        open = 0;
        if (k + 1 < n) open = sop[k + 1];
        if (cl[k] == open && op[k] == 0) {
          if (k + 1 < n) {
            if (scl[k + 1] == 0) c++;
          } else
            c++;
        }
      }
      swap(s[i], s[j]);
      if (mx < c) {
        mx = c;
        x1 = i + 1;
        x2 = j + 1;
      }
    }
  }
  cout << mx << endl;
  cout << x1 << " " << x2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  t = 1;
  while (t--) solve();
}
