#include <bits/stdc++.h>
using namespace std;
string cur;
int beauty() {
  int low = 0, c = 0;
  vector<int> bal(cur.length());
  for (int i = 0; i < cur.length(); i++) {
    bal[i] = (cur[i] == '(' ? 1 : -1);
    if (i) bal[i] += bal[i - 1];
  }
  for (int i = 0; i < bal.size(); i++) {
    if (i)
      low = min(low, bal[i]);
    else
      low = bal[i];
  }
  for (int i : bal)
    if (i == low) c++;
  return c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, ans = 0;
  pair<int, int> res;
  cin >> n >> cur;
  int open = 0;
  int close = 0;
  for (int i = 0; i < cur.length(); i++)
    if (cur[i] == '(')
      open++;
    else
      close++;
  if (open != close) {
    cout << "0\n1 1\n";
    return 0;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      swap(cur[i], cur[j]);
      int now = beauty();
      if (now > ans) {
        ans = now;
        res = {i, j};
      }
      swap(cur[i], cur[j]);
    }
  cout << ans << "\n";
  cout << res.first + 1 << " " << res.second + 1 << "\n";
  return 0;
}
