#include <bits/stdc++.h>
using namespace std;
char ch[300005];
int v[300005];
int ro[300005];
int rc[300005];
int lc[300005][3];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  cin >> ch;
  int max_ans = 0;
  int max_i = 1;
  int max_j = 1;
  int cnt_l = 0;
  int cnt_r = 0;
  int i, j, k;
  for (i = 0; i < n; i++) {
    if (ch[i] == '(')
      cnt_l++;
    else
      cnt_r++;
  }
  if (cnt_l != cnt_r) {
    cout << 0 << endl;
    cout << 1 << " " << 1 << endl;
    return 0;
  }
  int minV = n;
  for (i = 0; i < n; i++) {
    if (i == 0) {
      if (ch[i] == '(')
        v[i] = 1;
      else
        v[i] = -1;
    } else {
      if (ch[i] == '(')
        v[i] = v[i - 1] + 1;
      else
        v[i] = v[i - 1] - 1;
    }
    if (v[i] < minV) minV = v[i];
  }
  ro[n - 1] = n;
  rc[n - 1] = n;
  for (i = n - 2; i >= 0; i--) {
    ro[i] = ro[i + 1];
    rc[i] = rc[i + 1];
    if (ch[i + 1] == '(')
      ro[i] = i + 1;
    else
      rc[i] = i + 1;
  }
  for (i = 0; i < n; i++) {
    v[i] -= minV;
  }
  for (i = 0; i < n; i++) {
    if (i > 0) {
      lc[i][0] = lc[i - 1][0];
      lc[i][1] = lc[i - 1][1];
      lc[i][2] = lc[i - 1][2];
    }
    if (v[i] >= 0 && v[i] <= 2) {
      lc[i][v[i]]++;
    }
  }
  int cnt_zero = 0;
  for (i = 0; i < n; i++) {
    if (v[i] == 0) cnt_zero++;
  }
  int ans = cnt_zero;
  int ans_i = 1;
  int ans_j = 1;
  for (i = 0; i < n; i++) {
    if (v[i] == 0) break;
  }
  for (j = n - 1; j >= 0; j--) {
    if (v[j] == 0) break;
  }
  if (ro[j] != n) {
    int tmpl = 0;
    if (i > 0) tmpl += lc[i - 1][1];
    int tmpr = 0;
    tmpr = lc[n - 1][1] - lc[ro[j] - 1][1];
    if (tmpl + tmpr > ans) {
      ans = tmpl + tmpr;
      ans_i = i + 1;
      ans_j = ro[j] + 1;
    }
  }
  int tmplpos = -1;
  for (i = 0; i < n; i++) {
    if (ch[i] == ')') tmplpos = i;
    if (v[i] == 1 || v[i] == 0) break;
  }
  int tmprpos = -1;
  for (j = n - 1; j >= 0; j--) {
    if (v[j] == 1 || v[j] == 0) break;
    if (ch[j] == '(') tmprpos = j;
  }
  if (tmplpos != -1 && tmprpos != -1 && tmprpos > tmplpos) {
    int tmpl = 0;
    if (tmplpos > 0) tmpl += lc[tmplpos - 1][2];
    int tmpr = 0;
    tmpr = lc[n - 1][2] - lc[tmprpos - 1][2];
    int tmpm = lc[tmprpos - 1][0];
    if (tmplpos > 0) tmpm -= lc[tmplpos - 1][0];
    if (tmpl + tmpr + tmpm > ans) {
      ans = tmpl + tmpr + tmpm;
      ans_i = tmplpos + 1;
      ans_j = tmprpos + 1;
    }
  }
  int tmplo = -1;
  for (i = 0; i < n; i++) {
    if (ch[i] == ')') {
      if (tmplo != -1) {
        int tmpc = lc[i - 1][1];
        if (tmplo > 0) tmpc -= lc[tmplo - 1][1];
        if (tmpc > ans) {
          ans = tmpc;
          ans_i = tmplo + 1;
          ans_j = i + 1;
        }
      }
    }
    if (v[i] == 0) {
      tmplo = -1;
    } else {
      if (ch[i] == '(') {
        if (tmplo == -1) {
          tmplo = i;
        }
      }
    }
  }
  tmplo = -1;
  for (i = 0; i < n; i++) {
    if (ch[i] == ')') {
      if (tmplo != -1) {
        int tmpc = lc[i - 1][2];
        if (tmplo > 0) tmpc -= lc[tmplo - 1][2];
        if (tmpc + cnt_zero > ans) {
          ans = tmpc + cnt_zero;
          ans_i = tmplo + 1;
          ans_j = i + 1;
        }
      }
    }
    if (v[i] == 0 || v[i] == 1) {
      tmplo = -1;
    } else {
      if (ch[i] == '(') {
        if (tmplo == -1) {
          tmplo = i;
        }
      }
    }
  }
  cout << ans << endl;
  cout << ans_i << " " << ans_j << endl;
}
