#include <bits/stdc++.h>
using namespace std;
const int maxn = 550;
char saveori[550];
struct node {
  int lcnt, rcnt;
};
node toright[maxn];
node toleft[maxn];
int n;
int func() {
  toright[n + 1].lcnt = 0;
  toright[n + 1].rcnt = 0;
  for (int i = n; i > 0; i--) {
    toright[i] = toright[i + 1];
    if (saveori[i] == ')') toright[i].rcnt++;
    if (saveori[i] == '(') {
      if (toright[i].rcnt > 0)
        toright[i].rcnt--;
      else
        toright[i].lcnt++;
    }
  }
  toleft[0].lcnt = 0;
  toleft[0].rcnt = 0;
  for (int i = 1; i <= n; i++) {
    toleft[i] = toleft[i - 1];
    if (saveori[i] == ')') {
      if (toleft[i].lcnt > 0)
        toleft[i].lcnt--;
      else
        toleft[i].rcnt++;
    } else if (saveori[i] == '(')
      toleft[i].lcnt++;
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (toleft[i - 1].lcnt == 0 && toright[i].rcnt == 0 &&
        toleft[i - 1].rcnt == toright[i].lcnt) {
      cnt++;
    }
  }
  return cnt;
}
void solve() {
  cin >> n;
  scanf("%s", saveori + 1);
  int ans = 0;
  int ansl = 1, ansr = 1;
  for (int l = 1; l <= n; l++) {
    for (int r = l + 1; r <= n; r++) {
      swap(saveori[l], saveori[r]);
      int temp = func();
      if (temp > ans) {
        ans = temp;
        ansl = l;
        ansr = r;
      }
      swap(saveori[l], saveori[r]);
    }
  }
  printf("%d\n%d %d\n", ans, ansl, ansr);
}
int main() { solve(); }
