#include <bits/stdc++.h>
int n, l, r, t;
char s[501];
void f(char &a, char &b) {
  char tm = a;
  a = b;
  b = tm;
}
int main() {
  scanf("%d%s", &n, s);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      f(s[i], s[j]);
      int x = 0, m = n, y = 0;
      for (int k = 0; k < n; k++) {
        if (s[k] == '(')
          x++;
        else
          x--;
        if (x < m) m = x, y = 0;
        y += (x == m);
      }
      if (!x && t < y) t = y, l = i, r = j;
      f(s[i], s[j]);
    }
  }
  printf("%d\n%d %d", t, l + 1, r + 1);
}
