#include <bits/stdc++.h>
using namespace std;
const int N = 6e5 + 10;
int ans = 0, l = 0, r = 0, n, m, diff[N];
void evalDiff(string s) {
  s += s;
  for (int i = 0; i < s.size(); i++)
    diff[i + 1] = diff[i] + (s[i] == '(' ? 1 : -1);
}
int Less(vector<int> &cnt, int v) {
  int ans = 0;
  for (int i = v - m - 1; i >= 0; i--) ans += cnt[i];
  return ans;
}
bool increase(int v, int &j, vector<int> &cnt, vector<int> &curCnt) {
  for (; j <= 2 * n && Less(curCnt, v) < Less(cnt, v); j++)
    curCnt[diff[j] - m]++;
  return Less(curCnt, v) == Less(cnt, v);
}
void makeMin(int v, vector<int> &cnt, int m, int n) {
  vector<int> curCnt(n + 1);
  for (int i = 1, j = 1; i <= 2 * n; curCnt[diff[i] - m]--, i++) {
    if (!increase(v, j, cnt, curCnt)) return;
    if (diff[i] >= v) continue;
    if (ans > cnt[v - m] - curCnt[v - m] + Less(curCnt, v - 1)) continue;
    ans = cnt[v - m] - curCnt[v - m] + Less(curCnt, v - 1);
    l = i - 1;
    r = j - 1;
  }
}
void solve(string s) {
  evalDiff(s);
  if (diff[n] != 0) return;
  m = *min_element(diff, diff + n + 1);
  vector<int> cnt(n + 1);
  for (int i = 0; i < n; i++) cnt[diff[i] - m]++;
  for (int v : {m, m + 1, m + 2}) makeMin(v, cnt, m, n);
}
int main() {
  iostream::sync_with_stdio(false);
  string s;
  cin >> n >> s;
  solve(s);
  cout << ans << '\n';
  cout << l % n + 1 << ' ' << r % n + 1 << '\n';
}
