#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6 + 1;
const int INF = 2e9 + 1;
const int MOD = (1e9 + 7);
void bye(string s = "") {
  cout << s << '\n';
  exit(0);
}
int n;
vector<int> pref;
string s;
int check() {
  int mn = INF;
  if (pref[0] == ')')
    pref[0] = -1;
  else
    pref[0] = 1;
  int cnt = 1;
  mn = min(mn, pref[0]);
  for (int i = 1; i < n; i++) {
    if (s[i] == ')')
      pref[i] = pref[i - 1] - 1;
    else
      pref[i] = pref[i - 1] + 1;
    if (pref[i] == mn) {
      cnt++;
    } else if (pref[i] < mn) {
      mn = pref[i];
      cnt = 1;
    }
  }
  return cnt;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  cin >> s;
  pref.resize(n, INF);
  int ans = 0;
  pair<int, int> answer = {0, 0};
  int open = 0, close = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(')
      open++;
    else
      close++;
  }
  if (open != close) bye("0\n1 1");
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      swap(s[i], s[j]);
      int k = check();
      if (ans < k) {
        ans = k;
        answer = {i, j};
      }
      swap(s[i], s[j]);
    }
  }
  cout << ans << '\n';
  cout << answer.first + 1 << ' ' << answer.second + 1;
  bye();
}
