#include <bits/stdc++.h>
using namespace std;
char c[600];
vector<int> check;
int n;
vector<int> cal;
int calculate() {
  int num = 0;
  cal.clear();
  int minimum = INT_MAX;
  for (int i = 1; i <= n; i++) {
    if (c[i - 1] == '(') {
      num++;
      minimum = min(minimum, num);
      cal.push_back(num);
    } else {
      num--;
      minimum = min(minimum, num);
      cal.push_back(num);
    }
  }
  int ret = 0;
  for (int i = 1; i <= n; i++) {
    if (minimum == cal[i - 1]) {
      ret++;
    }
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  scanf("%s", c);
  int ans_l = 1, ans_r = 1;
  int beauty = INT_MIN;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (c[i - 1] == '(') {
      cnt++;
    } else {
      cnt--;
    }
  }
  if (cnt != 0) {
    printf("0\n1 1");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      char temp = c[j - 1];
      c[j - 1] = c[i - 1];
      c[i - 1] = temp;
      int now_beauty = calculate();
      if (beauty < now_beauty) {
        beauty = now_beauty;
        ans_l = i;
        ans_r = j;
      }
      temp = c[j - 1];
      c[j - 1] = c[i - 1];
      c[i - 1] = temp;
    }
  }
  printf("%d\n%d %d", beauty, ans_l, ans_r);
  return 0;
}
