#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, s = 0;
  cin >> n;
  char c;
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> c;
    if (c == '(') {
      a[i] = 1;
    } else
      a[i] = -1;
    s += a[i];
  }
  if (s != 0) {
    cout << "0\n1 1\n";
    return;
  }
  int ans = -1, wi, wj;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      swap(a[i], a[j]);
      int suff[n + 2];
      suff[n + 1] = 0;
      int m = -1, c = 0;
      for (int k = n; k > 0; k--) {
        suff[k] = suff[k + 1] + a[k];
        if (suff[k] > m) {
          m = suff[k];
          c = 1;
        } else if (suff[k] == m) {
          c++;
        }
      }
      if (c > ans) {
        ans = c;
        wi = i;
        wj = j;
      }
      swap(a[i], a[j]);
    }
  }
  cout << ans << '\n' << wi << ' ' << wj;
}
int main() {
  ios_base::sync_with_stdio(false);
  int t = 1;
  while (t--) solve();
}
