#include <bits/stdc++.h>
int n, f[1100], q[1100], he, ta, te, ans, a1, a2;
char s[1100], a[550];
int main() {
  scanf("%d%s", &n, a + 1);
  te = 0;
  for (int i = 1; i <= n; i++) s[i] = a[i];
  for (int i = 1; i <= n - 1; i++) s[i + n] = s[i];
  for (int i = 1; i <= n + n - 1; i++) {
    f[i] = f[i - 1];
    if (s[i] == '(')
      f[i]++;
    else
      f[i]--;
  }
  he = 1;
  ta = 0;
  for (int i = 1; i <= n + n - 1; i++) {
    while (he <= ta && f[i] < f[q[ta]]) ta--;
    q[++ta] = i;
    if (i >= n) {
      if (q[he] < i - n + 1) he++;
      if (f[i] == f[i - n] && f[q[he]] >= f[i - n]) te++;
    }
  }
  ans = te;
  a1 = 1;
  a2 = 1;
  for (int t1 = 1; t1 <= n; t1++)
    for (int t2 = t1; t2 <= n; t2++)
      if (a[t1] != a[t2]) {
        te = 0;
        for (int i = 1; i <= n; i++) s[i] = a[i];
        s[t1] = a[t2];
        s[t2] = a[t1];
        for (int i = 1; i <= n - 1; i++) s[i + n] = s[i];
        for (int i = 1; i <= n + n - 1; i++) {
          f[i] = f[i - 1];
          if (s[i] == '(')
            f[i]++;
          else
            f[i]--;
        }
        he = 1;
        ta = 0;
        for (int i = 1; i <= n + n - 1; i++) {
          while (he <= ta && f[i] < f[q[ta]]) ta--;
          q[++ta] = i;
          if (i >= n) {
            if (q[he] < i - n + 1) he++;
            if (f[i] == f[i - n] && f[q[he]] >= f[i - n]) te++;
          }
        }
        if (te > ans) {
          ans = te;
          a1 = t1;
          a2 = t2;
        }
      }
  printf("%d\n%d %d\n", ans, a1, a2);
  return 0;
}
