#include <bits/stdc++.h>
using namespace std;
char a[505];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n >> a + 1;
  int ans = 0, lp = 1, rp = 1;
  for (int i = 1; i <= n; i++) {
    a[i + n] = a[i];
    if (a[i] == '(')
      lp++;
    else
      rp++;
  }
  if (lp != rp) {
    cout << "0\n1 1\n" << endl;
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      swap(a[i], a[j]);
      int num = 0, start = 0x3f3f3f3f, tmp = 0;
      for (int k = 1; k <= n; k++) {
        if (a[k] == '(')
          num++;
        else
          num--, start = min(start, num);
      }
      for (int k = 1; k <= n; k++) {
        if (a[k] == '(')
          num++;
        else
          num--;
        if (num == start) tmp++;
      }
      swap(a[i], a[j]);
      if (tmp > ans) {
        ans = tmp;
        lp = i, rp = j;
      }
      ans = max(ans, tmp);
    }
  }
  cout << ans << endl;
  cout << lp << ' ' << rp << endl;
  return 0;
}
