#include <bits/stdc++.h>
using namespace std;
int n, ans, x, y;
char a[505];
int main() {
  x = 1, y = 1;
  scanf("%d%s", &n, a + 1);
  int s1 = 0, s2 = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == '(')
      s1++;
    else
      s2++;
  }
  if (s1 != s2) {
    printf("0\n1 1\n");
    return 0;
  }
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      swap(a[i], a[j]);
      int st = 0, c = 0, now = 0;
      for (int k = 1; k <= n; k++) {
        if (a[k] == '(')
          st++;
        else
          st--;
        if (st == now) c++;
        if (st < now) c = 1, now = st;
      }
      if (c > ans) ans = c, x = i, y = j;
      swap(a[i], a[j]);
    }
  }
  printf("%d\n%d %d", ans, x, y);
  return 0;
}
