#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, tp = 0, ans = 0, im, jm;
  cin >> n;
  char s[n];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    if (s[i] == ')')
      tp -= 1;
    else
      tp += 1;
  }
  if (tp != 0) {
    cout << 0 << endl << 1 << " " << 1;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      vector<int> v;
      int temp = 0, mi = 0, cnt = 0;
      swap(s[i], s[j]);
      for (int k = 0; k < n; k++) {
        if (s[k] == ')') {
          temp -= 1;
          v.push_back(temp);
        } else {
          temp += 1;
          v.push_back(temp);
        }
        mi = min(temp, mi);
      }
      for (int k = 0; k < n; k++) {
        if (v[k] == mi) cnt++;
      }
      if (cnt >= ans) {
        ans = cnt;
        im = i + 1;
        jm = j + 1;
      }
      swap(s[i], s[j]);
    }
  }
  cout << ans << endl << im << " " << jm;
  return 0;
}
