#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int mx = 0, ll = 1, rr = 1;
  int up = 0, down = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == ')')
      down++;
    else
      up++;
  }
  if (up == down) {
    for (int l = 0; l < n; l++) {
      for (int r = l; r < n; r++) {
        string cur = s;
        int ans = 0;
        swap(cur[l], cur[r]);
        vector<int> bal(n);
        bal[0] = cur[0] == ')' ? -1 : 1;
        int mn = bal[0], cnt = 0;
        for (int i = 1; i < n; i++) {
          bal[i] = bal[i - 1] + (cur[i] == ')' ? -1 : 1);
          mn = min(mn, bal[i]);
        }
        for (int i = 0; i < n; i++)
          if (bal[i] == mn) cnt++;
        ans = cnt;
        if (ans > mx) {
          mx = ans;
          ll = l + 1;
          rr = r + 1;
        }
      }
    }
  }
  cout << mx << '\n';
  cout << ll << " " << rr << '\n';
}
