#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAX_N = 500 + 5;
int n;
char s[MAX_N + 1];
int a[MAX_N + 1];
int m1[MAX_N + 1], m2[MAX_N + 1];
int get() {
  for (int i = 1; i <= n; i++) {
    if (s[i - 1] == '(')
      a[i] = a[i - 1] + 1;
    else
      a[i] = a[i - 1] - 1;
  }
  m1[1] = a[1];
  for (int i = 2; i <= n; i++) m1[i] = min(m1[i - 1], a[i]);
  m2[n] = a[n];
  for (int i = n - 1; i >= 1; i--) m2[i] = min(m2[i + 1], a[i]);
  int ans = 0;
  if (m1[n] >= 0) ans++;
  for (int i = n; i >= 2; i--) {
    int x = m2[i] - a[i - 1];
    int y = a[n] - a[i - 1] + m1[i - 1];
    if (x >= 0 && y >= 0) ans++;
  }
  return ans;
}
bool get2() {
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(')
      ans++;
    else
      ans--;
  }
  if (ans != 0) {
    printf("%d\n%d %d\n", 0, 1, 1);
    return true;
  }
  return false;
}
int main() {
  scanf("%d%s", &n, s);
  if (get2()) return 0;
  int res = 0, l = 1, r = 1;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      swap(s[i], s[j]);
      int ans = get();
      if (ans > res) {
        res = ans;
        l = i + 1, r = j + 1;
      }
      swap(s[i], s[j]);
    }
  }
  printf("%d\n%d %d\n", res, l, r);
  return 0;
}
