#include <bits/stdc++.h>
using namespace std;
string s;
int n, ans, cnt, l = 1, r = 1;
vector<char> v;
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      swap(s[i], s[j]);
      v.clear();
      cnt = 0;
      int wrong = 0;
      for (int k = 0; k < n; k++) {
        if (s[k] == '(') {
          v.push_back('(');
        } else {
          if (v.size()) {
            v.pop_back();
          } else {
            wrong++;
          }
        }
      }
      if (v.empty() && !wrong) {
        cnt++;
      }
      for (int k = 0; k < n - 1; k++) {
        if (s[k] == '(') {
          wrong++;
          v.push_back('(');
        } else if (!v.empty()) {
          wrong--;
          v.pop_back();
        }
        if (v.empty() && !wrong) {
          cnt++;
        }
      }
      if (cnt > ans) {
        ans = cnt;
        l = i + 1;
        r = j + 1;
      }
      swap(s[i], s[j]);
    }
  }
  cout << ans << endl << l << ' ' << r << endl;
  return 0;
}
