#include <bits/stdc++.h>
using namespace std;
using ll = long long;
long long calc(const vector<long long>& v) {
  vector<long long> pref = {v[0]};
  for (long long i = 1; i < v.size(); i++) {
    pref.push_back(pref[i - 1] + v[i]);
  }
  return count(begin(pref), end(pref), *min_element(begin(pref), end(pref)));
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  string s;
  cin >> n >> s;
  vector<long long> a;
  long long balance = 0;
  for (long long i = 0; i < n; i++) {
    if (s[i] == '(')
      a.push_back(1);
    else
      a.push_back(-1);
    balance += a.back();
  }
  if (balance != 0) {
    cout << 0 << endl;
    cout << 1 << " " << 1 << endl;
    return 0;
  }
  long long ans = 0;
  long long I = 1, J = 1;
  for (long long i = 0; i < n; i++) {
    for (long long j = i; j < n; j++) {
      swap(a[i], a[j]);
      long long res = calc(a);
      swap(a[i], a[j]);
      if (res > ans) {
        ans = res;
        I = i + 1;
        J = j + 1;
      }
    }
  }
  cout << ans << endl;
  cout << I << " " << J << endl;
}
