#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f, mod = 1000000007;
const double pi = 3.1415926535897932, eps = 1e-6;
int n, l, r, ans;
char s[505];
bool ok1[505], ok2[505];
int check() {
  int pre = 0, cnt = 0;
  for (int(i) = (1); (i) <= (n); (i)++) {
    if (s[i] == '(')
      pre++;
    else
      pre = max(pre - 1, 0);
    if (pre > 0)
      ok1[i] = 0;
    else
      ok1[i] = 1;
  }
  pre = 0;
  for (int(i) = (n); (i) >= (1); (i)--) {
    if (s[i] == '(')
      pre = max(pre - 1, 0);
    else
      pre++;
    if (pre > 0)
      ok2[i] = 0;
    else
      ok2[i] = 1;
  }
  pre = 0;
  for (int(i) = (1); (i) <= (n); (i)++) {
    if (s[i] == '(')
      pre++;
    else
      pre--;
    if (i < n) {
      if (ok1[i] && ok2[i + 1]) cnt++;
    } else if (ok1[n])
      cnt++;
  }
  return cnt;
}
int main() {
  scanf("%d%s", &n, s + 1);
  int pre = 0;
  for (int(i) = (1); (i) <= (n); (i)++)
    if (s[i] == '(')
      pre++;
    else
      pre--;
  if (pre != 0) {
    printf("0\n1 1");
    return 0;
  }
  for (int(i) = (1); (i) <= (n); (i)++)
    for (int(j) = (i); (j) <= (n); (j)++) {
      swap(s[i], s[j]);
      int w = check();
      if (ans < w) ans = w, l = i, r = j;
      swap(s[i], s[j]);
    }
  printf("%d\n%d %d", ans, l, r);
  return 0;
}
