#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int maxn = 505;
int n;
char s[maxn];
int ps[maxn], mn[maxn], mx[maxn];
inline int check() {
  ps[0] = 0;
  mn[0] = 1e9;
  for (int i = 1; i <= n; i++) {
    if (s[i] == '(') ps[i] = ps[i - 1] + 1;
    if (s[i] == ')') ps[i] = ps[i - 1] - 1;
    mn[i] = min(mn[i - 1], ps[i]);
  }
  mx[n + 1] = -1e9;
  int S = 0;
  for (int i = n; i >= 1; i--) {
    if (s[i] == '(') S++;
    if (s[i] == ')') S--;
    mx[i] = max(mx[i + 1], S);
  }
  int ss = 0, res = 0;
  if (mn[n] == 0) res = 1;
  for (int i = n; i >= 2; i--) {
    if (s[i] == '(') ss++;
    if (s[i] == ')') ss--;
    if (s[i] == '(') {
      if (mn[i - 1] + ss >= 0 && ss >= 0 && ss >= mx[i]) {
        res++;
      }
    }
  }
  return res;
}
int main() {
  n = read();
  scanf("%s", s + 1);
  int t = 0;
  for (int i = 1; i <= n; i++) {
    if (s[i] == '(') t++;
    if (s[i] == ')') t--;
  }
  if (t != 0) {
    cout << 0 << "\n";
    cout << 1 << " " << 1 << "\n";
    return 0;
  }
  int ans = 0, ansi = 1, ansj = 1;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      swap(s[i], s[j]);
      int temp = check();
      if (temp > ans) {
        ans = temp;
        ansi = i;
        ansj = j;
      }
      swap(s[i], s[j]);
    }
  cout << ans << "\n";
  cout << ansi << " " << ansj << "\n";
  return 0;
}
