#include <bits/stdc++.h>
using namespace std;
bool chmax(int& a, int b) {
  if (a < b) {
    a = b;
    return true;
  } else {
    return false;
  }
}
int main() {
  int N, A[300000];
  string S;
  cin >> N >> S;
  for (int i = 0; i < N; i++) A[i] = (S[i] == '(' ? 1 : -1);
  int C[300001] = {0};
  for (int i = 0; i < N; i++) C[i + 1] += C[i] + A[i];
  if (C[N] != 0) {
    cout << 0 << endl;
    cout << "1 1" << endl;
    return 0;
  }
  int m = *min_element(C, C + N + 1);
  int ans = 0;
  pair<int, int> ansp;
  static int dp[300001][3], prev[300001][3];
  for (int t = m - 2; t <= m + 2; t++)
    for (int swap_left : {1, -1}) {
      for (int i = 0; i <= N; i++)
        for (int k = 0; k < 3; k++) dp[i][k] = -1e9;
      dp[0][0] = 0;
      int offset[3] = {0, -2 * swap_left, 0};
      for (int i = 0; i < N; i++)
        for (int j = 0; j < 3; j++) {
          vector<int> moveto = {j};
          if (j == 0 && A[i] == swap_left) moveto.push_back(1);
          if (j == 1 && A[i] != swap_left) moveto.push_back(2);
          for (int k : moveto) {
            int c2 = C[i + 1] + offset[k];
            if (t > c2) continue;
            int d2 = dp[i][j] + (t == c2);
            if (chmax(dp[i + 1][k], d2)) prev[i + 1][k] = j;
          }
        }
      if (ans < dp[N][0]) {
        ans = dp[N][0];
        ansp = {1, 1};
      }
      if (ans < dp[N][2]) {
        ans = dp[N][2];
        int j = 2;
        vector<int> pp;
        for (int i = N; i > 0; i--)
          if (prev[i][j] != j) {
            pp.push_back(i);
            j = prev[i][j];
          }
        ansp = {pp[1], pp[0]};
      }
    }
  cout << ans << endl;
  cout << ansp.first << " " << ansp.second << endl;
  return 0;
}
