#include <bits/stdc++.h>
using namespace std;
int beauty_cycle(string s, int n) {
  int cnt[601] = {0}, min_cnt = INT_MAX, ans = 0;
  cnt[0] = (s[0] == '(') ? (1) : (-1);
  min_cnt = min(min_cnt, cnt[0]);
  for (int k = 1; k < n; k++) {
    if (s[k] == '(')
      cnt[k] = cnt[k - 1] + 1;
    else
      cnt[k] = cnt[k - 1] - 1;
    min_cnt = min(min_cnt, cnt[k]);
  }
  for (int k = 0; k < n; k++) {
    if (cnt[k] == min_cnt) ans++;
  }
  return ans;
}
int main() {
  int t = 1;
  while (t--) {
    int n, ans = -1, fir = -1, sec = -1;
    cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '(')
        cnt++;
      else
        cnt--;
    }
    if (cnt != 0) {
      cout << 0 << endl;
      cout << "1 1" << endl;
      break;
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (i == j && i != 0) continue;
        swap(s[i], s[j]);
        int val = beauty_cycle(s, n);
        swap(s[i], s[j]);
        if (ans < val) {
          ans = val;
          fir = i + 1;
          sec = j + 1;
        }
      }
    }
    cout << ans << endl;
    cout << fir << " " << sec << endl;
  }
  return 0;
}
