#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int a[maxn], n, ans = 0, p1 = 1, p2 = 1;
void upd(int val, int pos1, int pos2) {
  if (val > ans) ans = val, p1 = pos1, p2 = pos2;
}
void print() { cout << ans << '\n' << p1 << ' ' << p2; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    char c;
    cin >> c;
    if (c == '(')
      a[i] = 1;
    else
      a[i] = -1;
  }
  for (int i = 1; i <= n; i++) a[i] += a[i - 1];
  if (a[n]) {
    cout << "0\n1 1";
    return 0;
  }
  int low = 0, low_cnt = 0;
  for (int i = 1; i <= n; i++) low = min(low, a[i]);
  for (int i = 1; i <= n; i++)
    if (a[i] == low) low_cnt++;
  upd(low_cnt, 1, 1);
  int p1 = 0, p2 = 0, cnt = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] < low + 2) {
      p1 = i;
      break;
    }
  for (int i = n; i; i--)
    if (a[i] < low + 2) {
      p2 = i;
      break;
    }
  for (int i = 1; i <= p1 - 1; i++)
    if (a[i] == low + 2) cnt++;
  for (int i = p2 + 1; i <= n; i++)
    if (a[i] == low + 2) cnt++;
  if (p2 != n && a[p1] < a[p1 - 1] && a[p2] < a[p2 + 1])
    upd(low_cnt + cnt, p1, p2 + 1);
  for (int i = 1; i <= n; i++)
    if (a[i] == low) {
      p1 = i;
      break;
    }
  for (int i = n; i; i--)
    if (a[i] == low) {
      p2 = i;
      break;
    }
  cnt = 0;
  for (int i = 1; i <= p1 - 1; i++)
    if (a[i] == low + 1) cnt++;
  for (int i = p2 + 1; i <= n; i++)
    if (a[i] == low + 1) cnt++;
  if (p2 != n && a[p1] < a[p1 - 1] && a[p2] < a[p2 + 1]) upd(cnt, p1, p2 + 1);
  for (int i = 1; i < n; i++)
    if (a[i] >= low + 2) {
      int j = i;
      while (j < n && a[j] >= low + 2) j++;
      cnt = 0;
      for (int k = i; k <= j - 1; k++)
        if (a[k] == low + 2) cnt++;
      if (a[i] > a[i - 1] && a[j - 1] > a[j]) upd(low_cnt + cnt, i, j);
      i = j;
    }
  for (int i = 1; i < n; i++)
    if (a[i] >= low + 1) {
      int j = i;
      while (j < n && a[j] >= low + 1) j++;
      cnt = 0;
      for (int k = i; k <= j - 1; k++)
        if (a[k] == low + 1) cnt++;
      if (a[i] > a[i - 1] && a[j - 1] > a[j]) upd(cnt, i, j);
      i = j;
    }
  print();
  return 0;
}
