#include <bits/stdc++.h>
using namespace std;
long long calc(string& a) {
  long long bal = 0;
  long long l = -1;
  for (long long i = 0; i < a.size(); i++) {
    if (a[i] == '(')
      bal++;
    else
      bal--;
    if (bal < 0) {
      l = i;
      while (bal < 0) {
        if (a.back() == '(') {
          bal++;
        } else {
          bal--;
        }
        a.pop_back();
      }
    }
  }
  long long ans = (l > -1);
  bal = 0;
  a.erase(a.begin(), a.begin() + l + 1);
  for (l = 0; l < a.size(); l++) {
    if (a[l] == '(')
      bal++;
    else
      bal--;
    if (bal == 0) ++ans;
  }
  return ans;
}
void solve() {
  long long n;
  cin >> n;
  string a;
  cin >> a;
  long long op = 0, cl = 0;
  for (char& x : a) {
    if (x == '(')
      op++;
    else
      cl++;
  }
  if (op != cl) {
    cout << 0 << '\n';
    cout << 1 << " " << 1;
    return;
  }
  long long ans = 0, f = 1, s = 1;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      swap(a[i], a[j]);
      string b = a;
      long long res = calc(b);
      if (res > ans) {
        ans = res, f = i, s = j;
      }
      swap(a[i], a[j]);
    }
  }
  cout << ans << '\n';
  cout << f + 1 << " " << s + 1;
  return;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  long long t = 1;
  while (t--) {
    solve();
    cout << '\n';
  }
  return 0;
}
