#include <bits/stdc++.h>
using namespace std;
int n, b[1500000], a[1500000], mi[1500000], sum[1500000], ans, ansl, ansr;
char s[1500000];
void deal(int l, int r) {
  for (int i = 1; i <= n; i++) b[i] = a[i];
  swap(b[l], b[r]);
  mi[0] = 0x7fffffff;
  for (int i = 1; i <= n; i++)
    mi[i] = min(sum[i - 1] + b[i], mi[i - 1]), sum[i] = sum[i - 1] + b[i];
  int ans1 = 0, pos = 0;
  if (mi[n] >= 0) ans1++;
  for (int i = n; i > 1; i--) {
    pos = pos + b[i];
    pos = min(pos, b[i]);
    if (mi[i - 1] + sum[n] - sum[i - 1] >= 0 && pos >= 0) ans1++;
  }
  if (ans1 > ans) {
    ans = ans1;
    ansl = l;
    ansr = r;
  }
}
int main() {
  scanf("%d%s", &n, s);
  for (int i = 0; i < n; i++) a[i + 1] = s[i] == '(' ? 1 : -1;
  for (int i = 1; i <= n; i++) ans = ans + a[i];
  if (ans != 0) {
    printf("0\n1 1");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (a[i] != a[j]) deal(i, j);
    }
  }
  deal(1, 1);
  printf("%d\n%d %d", ans, ansl, ansr);
}
