#include <bits/stdc++.h>
using namespace std;
inline void ju() {
  freopen("***.in", "r", stdin);
  freopen("***.out", "w", stdout);
}
inline long long rd() {
  long long x = 0, f = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && (c != '-')) c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar();
  }
  return x * f;
}
const int N = 3e5 + 10;
char s[N];
int a[N], b[N], ans, x, y;
int main() {
  int n = rd();
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) {
    if (s[i] == '(')
      a[i] = 1;
    else
      a[i] = -1;
    b[i] = b[i - 1] + a[i];
  }
  if (b[n]) {
    puts("0\n1 1");
    return 0;
  }
  for (int p = 1; p <= n; ++p) {
    for (int q = p; q <= n; ++q) {
      swap(a[p], a[q]);
      for (int i = 1; i <= n; ++i) b[i] = b[i - 1] + a[i];
      int mn = 0, cnt = 0;
      for (int i = 1; i <= n; ++i)
        if (b[i] < mn) mn = b[i];
      for (int i = 1; i <= n; ++i)
        if (b[i] == mn) cnt++;
      if (cnt > ans) {
        ans = cnt;
        x = p, y = q;
      }
      swap(a[p], a[q]);
    }
  }
  cout << ans << endl << x << ' ' << y << endl;
  return 0;
}
