#include <bits/stdc++.h>
using namespace std;
int n, x, y, ans;
string s;
int pref[502];
int main() {
  cin >> n;
  cin >> s;
  ans = -1;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      swap(s[i], s[j]);
      int mn = n + 1, cnt = 0;
      for (int k = 0; k < n; k++) {
        pref[k] = (s[k] == '(' ? 1 : -1) + (k == 0 ? 0 : pref[k - 1]);
        if (mn > pref[k]) {
          mn = pref[k];
          cnt = 1;
        } else if (mn == pref[k])
          cnt++;
      }
      if (pref[n - 1] != 0) cnt = 0;
      if (ans < cnt) {
        ans = cnt;
        x = i, y = j;
      }
      swap(s[i], s[j]);
    }
  cout << max(ans, 0) << "\n";
  cout << x + 1 << " " << y + 1;
  return 0;
}
