#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;
  string S;
  cin >> N >> S;
  int C[300001];
  int mn = 0, s = 0;
  for (int i = 0; i < N; i++) {
    s += (S[i] == '(' ? 1 : -1);
    C[i] = s;
    mn = min(mn, s);
  }
  if (s != 0) {
    cout << 0 << endl;
    cout << "1 1" << endl;
    return 0;
  }
  int ans = 0;
  pair<int, int> ansp;
  static int dp[300001][3], prev[300001][3];
  for (int t = mn - 2; t <= mn + 2; t++)
    for (int d : {-2, 2}) {
      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, d, 0};
      char c_left = (d == 2 ? ')' : '(');
      for (int i = 0; i < N; i++)
        for (int j = 0; j < 3; j++) {
          vector<int> moveto = {j};
          if (j == 0 && S[i] == c_left) moveto.push_back(1);
          if (j == 1 && S[i] != c_left) moveto.push_back(2);
          for (int k : moveto) {
            int v = C[i] + offset[k];
            if (t > v) continue;
            int d2 = dp[i][j] + (t == v);
            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;
}
