#include <bits/stdc++.h>
const int maxn = 5e2 + 10;
int n;
char s[maxn];
int a[maxn], b[maxn] = {0};
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    a[i] = s[i] == '(' ? 1 : -1;
    b[i] = b[i - 1] + a[i];
  }
  if (b[n] != 0) {
    printf("0\n1 1\n");
    return 0;
  }
  int ans = 0, ansx, ansy;
  for (int p = 1; p <= n; p++) {
    for (int q = p; q <= n; q++) {
      int min = 0x7fffffff, tmpans = 0;
      std::swap(a[p], a[q]);
      for (int i = 1; i <= n; i++)
        b[i] = b[i - 1] + a[i], min = std::min(min, b[i]);
      for (int i = 1; i <= n; i++)
        if (b[i] == min) tmpans++;
      if (tmpans > ans) {
        ans = tmpans;
        ansx = p;
        ansy = q;
      }
      std::swap(a[p], a[q]);
    }
  }
  printf("%d\n%d %d\n", ans, ansx, ansy);
}
