#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300000;
int n, balance[MAXN + 9] = {0};
int min_balance = MAXN;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    char ch;
    cin >> ch;
    balance[i] = balance[i - 1] + ((ch == '(') ? 1 : -1);
    min_balance = min(min_balance, balance[i]);
  }
  if (balance[n] != 0) {
    cout << 0 << "\n";
    cout << 1 << " " << 1 << "\n";
  } else {
    int count[3] = {0};
    int firstIndex[3], lastIndex[3];
    for (int i = 1; i <= n; i++) {
      int diff = balance[i] - min_balance;
      if (diff <= 2) {
        count[diff]++;
        if (count[diff] == 1) {
          firstIndex[diff] = i;
        }
        lastIndex[diff] = i;
      }
    }
    int max_beauty = count[0];
    pair<int, int> swap_pair = make_pair(1, 1);
    if (lastIndex[0] != n) {
      int candidate_beauty = count[1];
      for (int i = firstIndex[0]; i <= lastIndex[0]; i++) {
        if (balance[i] == min_balance + 1) {
          candidate_beauty--;
        }
      }
      if (max_beauty < candidate_beauty) {
        max_beauty = candidate_beauty;
        swap_pair = make_pair(firstIndex[0], lastIndex[0] + 1);
      }
    }
    if (max(lastIndex[0], lastIndex[1]) != n) {
      int candidate_beauty = count[0] + count[2];
      int l = min(firstIndex[0], firstIndex[1]);
      int r = max(lastIndex[0], lastIndex[1]);
      for (int i = l; i <= r; i++) {
        if (balance[i] == min_balance + 2) {
          candidate_beauty--;
        }
      }
      if (max_beauty < candidate_beauty) {
        max_beauty = candidate_beauty;
        swap_pair = make_pair(l, r + 1);
      }
    }
    int c1 = 0, c2 = 0, j = 1, k = 1;
    for (int i = 1; i <= n; i++) {
      if (balance[i] - min_balance <= 1 && j <= i) {
        if (max_beauty < count[0] + c2) {
          max_beauty = count[0] + c2;
          swap_pair = make_pair(j, i);
        }
        c2 = 0;
        j = i + 1;
      }
      if (balance[i] - min_balance == 2) {
        c2++;
      }
      if (balance[i] - min_balance == 0 && k <= i) {
        if (max_beauty < c1) {
          max_beauty = c1;
          swap_pair = make_pair(k, i);
        }
        c1 = 0;
        k = i + 1;
      }
      if (balance[i] - min_balance == 1) {
        c1++;
      }
    }
    cout << max_beauty << "\n";
    cout << swap_pair.first << " " << swap_pair.second << "\n";
  }
  return 0;
}
