#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n, i, j, k, c, v, l = 1, r = 1, maxm = 0, minm;
  cin >> n;
  int A[n];
  string s;
  cin >> s;
  for (i = 0; i < n; i++) A[i] = 0;
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++) {
      swap(s[i], s[j]);
      v = 0;
      c = 0;
      for (k = 0; k < n; k++) {
        if (s[k] == '(')
          v++;
        else
          v--;
        A[k] = v;
      }
      if (v == 0) {
        minm = 0;
        for (k = 0; k < n; k++) {
          if (A[k] < minm) {
            minm = A[k];
            c = 1;
          } else if (A[k] == minm)
            c++;
        }
        if (c > maxm) {
          maxm = c;
          l = i + 1;
          r = j + 1;
        }
      }
      swap(s[i], s[j]);
    }
  }
  cout << maxm << endl;
  cout << l << " " << r << endl;
}
