#include <bits/stdc++.h>
using namespace std;
int N, res = 0, resL = 1, resR = 1;
string s, t;
int v[300301];
vector<int> iidx;
vector<int> seg(1050000, 0), lazy(1050000, 0);
void Propagate(int n, int l, int r) {
  if (lazy[n]) {
    if (l != r) {
      lazy[n * 2] += lazy[n];
      lazy[n * 2 + 1] += lazy[n];
    }
    seg[n] += lazy[n];
    lazy[n] = 0;
  }
}
int Update(int L, int R, int val, int n, int l, int r) {
  Propagate(n, l, r);
  if (r < L || R < l) return seg[n];
  if (L <= l && r <= R) {
    lazy[n] += val;
    Propagate(n, l, r);
    return seg[n];
  }
  int mid = l + r >> 1;
  return seg[n] = max(Update(L, R, val, n * 2, l, mid),
                      Update(L, R, val, n * 2 + 1, mid + 1, r));
}
int Delete(int idx, int n, int l, int r) {
  Propagate(n, l, r);
  if (r < idx || idx < l) return seg[n];
  if (l == r) {
    Propagate(n, l, r);
    seg[n] = 0;
    return seg[n];
  }
  int mid = l + r >> 1;
  return seg[n] = max(Delete(idx, n * 2, l, mid),
                      Delete(idx, n * 2 + 1, mid + 1, r));
}
int Query(int L, int R, int n, int l, int r) {
  Propagate(n, l, r);
  if (r < L || R < l) return 0;
  if (L <= l && r <= R) return seg[n];
  int mid = l + r >> 1;
  return max(Query(L, R, n * 2, l, mid), Query(L, R, n * 2 + 1, mid + 1, r));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> s;
  int mn = 1234567890, pos = -1, cnt = 0;
  for (int i = 0; i < N; i++) {
    if (s[i] == '(')
      cnt++;
    else
      cnt--;
    if (mn > cnt) mn = cnt, pos = i;
  }
  if (cnt != 0) return !printf("0\n1 1");
  for (int i = pos + 1; i < N; i++) {
    t += s[i];
    iidx.push_back(i + 1);
  }
  for (int i = 0; i <= pos; i++) {
    t += s[i];
    iidx.push_back(i + 1);
  }
  s = t;
  cnt = 0;
  int zero = 0, one = 0, two = 0;
  for (int i = 0; i < N; i++) {
    if (s[i] == '(')
      cnt++;
    else
      cnt--;
    if (cnt == 0)
      zero++;
    else if (cnt == 1)
      one++;
    else if (cnt == 2)
      two++;
    v[i] = cnt;
  }
  if (res < zero) res = zero, resL = 1, resR = 1;
  cnt = -1234567890, pos = -1;
  for (int i = 0; i < N; i++) {
    if (s[i] == '(') {
      if (cnt == -1234567890) cnt = 0, pos = i;
    } else {
      int val = cnt + zero;
      if (res < val) res = val, resL = iidx[pos], resR = iidx[i];
    }
    if (v[i] == 0 || v[i] == 1) {
      cnt = -1234567890;
    } else if (v[i] == 2) {
      cnt++;
    } else
      ;
  }
  cnt = -1234567890, pos = -1;
  for (int i = 0; i < N; i++) {
    if (s[i] == '(') {
      if (pos == -1) pos = i;
    } else {
      int val = cnt;
      if (res < val && pos != -1 && cnt != -1234567890)
        res = val, resL = iidx[pos], resR = iidx[i];
    }
    if (v[i] == 0) {
      cnt = -1234567890;
      pos = -1;
    } else if (v[i] == 1) {
      if (cnt == -1234567890) cnt = 0;
      if (pos != -1) cnt++;
    } else
      ;
  }
  cnt = -1234567890, pos = -1;
  for (int i = 0; i < N; i++) {
    if (s[i] == '(') {
      if (pos == -1) pos = i;
    } else {
      int val = cnt;
      if (res < val && pos != -1 && cnt != -1234567890)
        res = val, resL = iidx[pos], resR = iidx[i];
    }
    if (v[i] == 0) {
      if (cnt == -1234567890) cnt = 0;
      if (pos != -1) cnt++;
    } else
      ;
  }
  printf("%d\n%d %d", res, resL, resR);
  return 0;
}
