#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, l = 1, r = 1, ans;
char s[N], b[N];
int main() {
  scanf("%d%s", &n, s + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      swap(s[i], s[j]);
      int mi = 0, cnt = 0, sum = 0;
      for (int k = 1; k <= n; k++) {
        s[k] == '(' ? cnt++ : cnt--;
        if (cnt == mi) sum++;
        if (cnt < mi) mi = cnt, sum = 1;
      }
      if (!cnt && sum > ans) l = i, r = j, ans = sum;
      swap(s[i], s[j]);
    }
  }
  printf("%d\n%d %d\n", ans, l, r);
  return 0;
}
