#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5 + 10;
const double eps = 1e-9;
const int inf = 1e9;
char a[mx];
int n;
int main() {
  int ans = -1, l = 1, r = 1;
  scanf("%d%s", &n, a);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      swap(a[i], a[j]);
      int cnt = 0, curans = 0, tmp = 0;
      for (int k = 0; k < n; k++) {
        if (a[k] == '(')
          ++cnt;
        else {
          --cnt;
          if (!cnt) curans++;
          if (cnt < 0) {
            ++tmp;
            curans = 0;
            cnt = 0;
          }
        }
      }
      if (tmp) {
        cnt -= tmp;
        curans++;
      }
      if (!cnt) {
        if (curans > ans) {
          ans = curans;
          l = i;
          r = j;
        }
      }
      swap(a[i], a[j]);
    }
  }
  if (ans == -1) ans = 0, l = 0, r = 0;
  printf("%d\n%d %d", ans, l + 1, r + 1);
}
