#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int lowest = n;
  vector<int> t(n);
  for (int i = 0; i < n; i++) {
    t[i] = (i ? t[i - 1] : 0) + (s[i] == '(' ? 1 : -1);
    lowest = min(lowest, t[i]);
  }
  if (t.back() != 0) {
    cout << "0\n1 1\n";
    return 0;
  }
  vector<int> freq[3];
  for (int k = 0; k < 3; k++) {
    freq[k].assign(n, 0);
    for (int i = 0; i < n; i++) {
      freq[k][i] = (i ? freq[k][i - 1] : 0) + (t[i] == (lowest + k));
    }
  }
  vector<int> next_opening(n, n + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (i + 1 < n) next_opening[i] = next_opening[i + 1];
    if (s[i] == '(') next_opening[i] = i;
  }
  int ret = freq[0].back();
  int x, y;
  x = y = 0;
  int last[3];
  fill(last, last + 3, -1);
  for (int i = 0; i < n - 1; i++) {
    if (t[i] - 2 > lowest) continue;
    int k = t[i] - lowest;
    last[k] = i;
    if (s[i + 1] == ')') {
      int bad = -1;
      for (int j = 0; j < k; j++) bad = max(bad, last[j]);
      bad = next_opening[bad + 1];
      if (false) cout << bad << " " << i << endl;
      if (bad <= i) {
        int score = 0;
        if (k == 2) score += freq[0].back();
        if (false) cout << "\t" << score << endl;
        score += freq[k][i] - (bad ? freq[k][bad - 1] : 0);
        if (false) cout << "\t" << score << endl;
        if (score > ret) {
          ret = score;
          x = bad;
          y = i + 1;
        }
      }
    }
  }
  int lo = n + 1, hi = 0;
  for (int i = 0; i < n; i++) {
    if (t[i] == lowest) {
      lo = min(lo, i);
      hi = max(hi, i + 1);
    }
  }
  if (false) cout << "r" << lo << " " << hi << endl;
  if (lo < hi && hi < n) {
    int score = 0;
    if (lo) score += freq[1][lo - 1];
    score += freq[1].back() - freq[1][hi - 1];
    if (false) cout << "\t" << score << endl;
    if (score > ret) {
      ret = score;
      x = lo;
      y = hi;
    }
  }
  for (int i = 0; i < n; i++) {
    if (t[i] == (lowest + 1)) {
      lo = min(lo, i);
      hi = max(hi, i + 1);
    }
  }
  if (lo < hi && hi < n) {
    int score = 0;
    if (lo) score += freq[2][lo - 1];
    score += freq[2].back() - freq[2][hi - 1];
    score += freq[0][hi - 1] - (lo ? freq[0][lo - 1] : 0);
    if (score > ret) {
      ret = score;
      x = lo;
      y = hi;
    }
  }
  cout << ret << endl;
  cout << x + 1 << " " << y + 1 << endl;
  return 0;
}
