This is a harder version of the problem. In this version, $$$n \le 300\,000$$$.Vasya is an experienced developer of programming competitions' problems. As all great minds at some time, Vasya faced a creative crisis. To improve the situation, Petya gifted him a string consisting of opening and closing brackets only. Petya believes, that the beauty of the bracket string is a number of its cyclical shifts, which form a correct bracket sequence.To digress from his problems, Vasya decided to select two positions of the string (not necessarily distinct) and swap characters located at this positions with each other. Vasya will apply this operation exactly once. He is curious what is the maximum possible beauty he can achieve this way. Please help him.We remind that bracket sequence $$$s$$$ is called correct if:   $$$s$$$ is empty;  $$$s$$$ is equal to "($$$t$$$)", where $$$t$$$ is correct bracket sequence;  $$$s$$$ is equal to $$$t_1 t_2$$$, i.e. concatenation of $$$t_1$$$ and $$$t_2$$$, where $$$t_1$$$ and $$$t_2$$$ are correct bracket sequences. For example, "(()())", "()" are correct, while ")(" and "())" are not.The cyclical shift of the string $$$s$$$ of length $$$n$$$ by $$$k$$$ ($$$0 \leq k < n$$$) is a string formed by a concatenation of the last $$$k$$$ symbols of the string $$$s$$$ with the first $$$n - k$$$ symbols of string $$$s$$$. For example, the cyclical shift of string "(())()" by $$$2$$$ equals "()(())".Cyclical shifts $$$i$$$ and $$$j$$$ are considered different, if $$$i \ne j$$$.

The first line contains an integer $$$n$$$ ($$$1 \le n \le 300\,000$$$), the length of the string. The second line contains a string, consisting of exactly $$$n$$$ characters, where each of the characters is either "(" or ")".

The first line should contain a single integer — the largest beauty of the string, which can be achieved by swapping some two characters. The second line should contain integers $$$l$$$ and $$$r$$$ ($$$1 \leq l, r \leq n$$$) — the indices of two characters, which should be swapped in order to maximize the string's beauty. In case there are several possible swaps, print any of them.

NoteIn the first example, we can swap $$$7$$$-th and $$$8$$$-th character, obtaining a string "()()()()()". The cyclical shifts by $$$0, 2, 4, 6, 8$$$ of this string form a correct bracket sequence.In the second example, after swapping $$$5$$$-th and $$$10$$$-th character, we obtain a string ")(())()()(()". The cyclical shifts by $$$11, 7, 5, 3$$$ of this string form a correct bracket sequence.In the third example, swap of any two brackets results in $$$0$$$ cyclical shifts being correct bracket sequences.

import java.io.BufferedInputStream;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Locale;
import java.util.Scanner;

public class TaskD {
    private static final String QUICK_ANSWER = "NO";
    private final Scanner in;
    private final StringBuilder out;
    private final int n;
    private final char[] chars;
    private final boolean[] up;
    int minPos;

    public TaskD(Scanner in, StringBuilder out) throws QuickAnswer {
        this.in = in;
        this.out = out;
        n = nextInt();
        chars = nextString().toCharArray();
        int lev = 0;
        int minLev = 0;
        int minPos = 0;
        for (int i = 0; i < n; i++) {
            if (chars[i] == '(') ++lev;
            else --lev;
            if (lev < minLev) {
                minLev = lev;
                minPos = i + 1;
            }
        }
        if (lev != 0) {
            quickAnswer("0\n1 1");
        }
        minPos %= n;
        this.minPos = minPos;
        up = new boolean[n];
        for (int i = 0; i < n; i++) {
            up[i] = chars[(i + minPos) % n] == '(';
        }
    }

    public void solve() throws QuickAnswer {
        int lev = 0;
        int i1 = 0;
        int i2 = 0;
        int bonus = 0;
        int istart = -1;
        int b = 1;
        for (int i = 0; i < n; i++) {
            if (up[i]) lev++;
            else lev--;
            if (lev == 2) {
                if (up[i]) istart = i;
                else ++b;
            } else if (lev == 1 && !up[i]) {
                if (b > bonus) {
                    i1 = istart;
                    i2 = i;
                    bonus = b;
                }
                istart = -1;
                b = 1;
            }
        }

        up[i1] = false;
        up[i2] = true;
        lev = 0;
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (up[i]) lev++;
            else lev--;
            if (lev == 0) ++cnt;
        }
        up[i1] = true;
        up[i2] = false;

        int cnt1 = 0;
        int last0 = 0;
        for (int i = 0; i < n; i++) {
            if (up[i]) lev++;
            else lev--;
            if (lev == 1) ++cnt1;
            if (lev == 0) {
                if (cnt1 > cnt) {
                    i1 = last0;
                    i2 = i;
                    cnt = cnt1;
                }
                cnt1 = 0;
                last0 = i + 1;
            }
        }

        println(cnt);
        print(1 + (i1 + minPos) % n, 1 + (i2 + minPos) % n);

    }

    // Common functions

    void quickAnswer(String answer) throws QuickAnswer {
        throw new QuickAnswer(answer);
    }

    void quickAnswer() throws QuickAnswer {
        quickAnswer(QUICK_ANSWER);
    }

    static class QuickAnswer extends Exception {
        private String answer;

        public QuickAnswer(String answer) {
            this.answer = answer;
        }
    }

    void print(Object... args) {
        String prefix = "";
        for (Object arg : args) {
            out.append(prefix);
            out.append(arg);
            prefix = " ";
        }
    }

    void println(Object... args) {
        print(args);
        out.append("\n");
    }

    void printsp(Object... args) {
        print(args);
        out.append(" ");
    }

    int nextInt() {
        return in.nextInt();
    }

    long nextLong() {
        return in.nextLong();
    }

    String nextString() {
        String res = in.nextLine();
        return res.trim().isEmpty() ? in.nextLine() : res;
    }

    int[] nextInts(int count) {
        int[] res = new int[count];
        for (int i = 0; i < count; ++i) {
            res[i] = in.nextInt();
        }
        return res;
    }

    long[] nextLongs(int count) {
        long[] res = new long[count];
        for (int i = 0; i < count; ++i) {
            res[i] = in.nextInt();
        }
        return res;
    }

    public static void main(String[] args) {
        doMain(System.in, System.out);
    }

    static void doMain(InputStream inStream, PrintStream outStream) {
        Scanner in = new Scanner(new BufferedInputStream(inStream)).useLocale(Locale.ENGLISH);
        StringBuilder totalOut = new StringBuilder();
        int count = 1;
        //count = in.nextInt();
        while (count-- > 0) {
            try {
                StringBuilder out = new StringBuilder();
                new TaskD(in, out).solve();
                totalOut.append(out.toString());
            } catch (QuickAnswer e) {
                totalOut.append(e.answer);
            }
            if (count > 0) {
                totalOut.append("\n");
            }
        }
        outStream.print(totalOut.toString());
    }
}

/**
 * BaZ :D
 */
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main
{
    static MyScanner scan;
    static PrintWriter pw;
    static long MOD = 1_000_000_007;
    static long INF = 1_000_000_000_000_000_000L;
    static long inf = 2_000_000_000;
    public static void main(String[] args) {
        new Thread(null, null, "BaZ", 1 << 27) {
            public void run() {
                try {
                    solve();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static int idx1, idx2;
    static char c[];
    static void solve() throws IOException
    {
        //initIo(true);
        initIo(false);
        StringBuilder sb = new StringBuilder();
        int n = ni();
        c = ne().toCharArray();
        int bal[] = new int[n];
        int open = 0;
        for(int i=0;i<n;++i) {
            if(c[i] == '(') {
                bal[i]++;
                open++;
            }
            else {
                bal[i]--;
            }
            if(i-1>=0) {
                bal[i]+=bal[i-1];
            }
        }
        if(open != n - open) {
            pl("0\n1 1");
            System.exit(0);
        }
        int min = Integer.MAX_VALUE, at = -1;
        for(int i=0;i<n;++i) {
            if(bal[i]<min) {
                min = bal[i];
                at = i;
            }
        }
        //pa("bal", bal);
        int arr[] = new int[n];
        int ptr = 0;
        for(int i=at+1;i<n;++i) {
            arr[ptr++] = bal[i] - min;
        }
        for(int i=0;i<=at;++i) {
            arr[ptr++] = bal[i] - min;
        }
        //pa("arr", arr);
        int max = -1, ans_idx1 = -1, ans_idx2 = -1;
        idx1 = idx2 = 0;
        int zero = calc(arr,0,n,false, (at+1 ==n ? 0 : at+1));
        //pl("zero : " + zero);
        if(zero>max) {
            max = zero;
            ans_idx1 = 0;
            ans_idx2 = 0;
        }
        idx1 = idx2 = 0;
        int one = calc(arr,1,n,false, (at+1 ==n ? 0 : at+1));
        if(one>max) {
            max = one;
            ans_idx1 = idx1;
            ans_idx2 = idx2;
        }
        //pl("one : " + one);
        idx1 = idx2 = 0;
        int two = calc(arr,2,n,true, (at+1 ==n ? 0 : at+1));
        if(two>max) {
            max = two;
            ans_idx1 = idx1;
            ans_idx2 = idx2;
        }
        //pl("two : " + two);
        pl(max);
        pl((1+getOriginalIndex(at+1 == n ? 0 : at+1, n, ans_idx1)) + " " + (1+getOriginalIndex(at+1 == n ? 0 : at+1, n, ans_idx2)));
        pw.flush();
        pw.close();
    }
    static int getOriginalIndex(int from_where, int n, int idx) {
        if(idx<=n-1-from_where) {
            return from_where + idx;
        }
        else {
            return idx - (n-from_where);
        }
    }
    static int calc(int arr[], int k, int n, boolean shouldAdd, int from_where) {
        int till[] = new int[n];
        int cum[] = new int[n];
        int pref[] = new int[n];
        int suff[] = new int[n];
        for(int i=n-1;i>=0;--i) {
            if(arr[i] == 0) {
                ++suff[i];
            }
            if(i+1<n) {
                suff[i]+=suff[i+1];
            }
        }
        for(int i=0;i<n;++i) {
            if(arr[i] == k) {
                cum[i]++;
            }
            if(arr[i] == 0) {
                ++pref[i];
            }
            if(i>0) {
                cum[i]+=cum[i-1];
                pref[i]+=pref[i-1];
            }
        }
        for(int i=n-1;i>=0;--i) {
            if(arr[i] >= k) {
                till[i] = (i+1 < n  ? till[i+1] : n);
            }
            else {
                till[i] = i;
            }
        }
        int max = -1;
        for(int i=0;i<n;++i) {
            if(till[i]==i) {
                continue;
            }
            if(c[getOriginalIndex(from_where, n, i)] == ')') {
                continue;
            }
            int ispe = (till[i] - 1 > 0 ? cum[till[i] - 1] : 0) - (i > 0 ? cum[i-1] : 0);
            if(shouldAdd) {
                ispe+=(i-1>0 ? pref[i-1] : 0);
                ispe+=(till[i] < n ? suff[till[i]] : 0);
            }
            if(max<ispe) {
                idx1 = i;
                idx2 = min(n-1, till[i]);
                max = ispe;
            }
        }
        return max;
    }
    static void initIo(boolean isFileIO) throws IOException {
        scan = new MyScanner(isFileIO);
        if(isFileIO) {
            pw = new PrintWriter("/Users/amandeep/Desktop/output.txt");
        }
        else {
            pw = new PrintWriter(System.out, true);
        }
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static String ne() throws IOException
    {
        return scan.next();
    }
    static String nel() throws IOException
    {
        return scan.nextLine();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    static void pa(String arrayName, Object[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(Object o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, int[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(int o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, long[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(long o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, char[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(char o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, double[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(double o : arr[i])
                p(o);
            pl();
        }
    }
    static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;
        MyScanner(boolean readingFromFile) throws IOException
        {
            if(readingFromFile) {
                br = new BufferedReader(new FileReader("/Users/amandeep/Desktop/input.txt"));
            }
            else {
                br = new BufferedReader(new InputStreamReader(System.in));
            }
        }
        String nextLine()throws IOException
        {
            return br.readLine();
        }
        String next() throws IOException
        {
            if(st==null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        int nextInt() throws IOException
        {
            return Integer.parseInt(next());
        }
        long nextLong() throws IOException
        {
            return Long.parseLong(next());
        }
        double nextDouble() throws IOException
        {
            return Double.parseDouble(next());
        }
    }
}

import java.io.*;
import java.util.*;

public class Main {
    static int inf = (int) 1e9 + 7;
    static int n, a[];

    static int min() {
        int ans = inf;
        for(int i = 0;i < n;i++) ans = Math.min(ans, a[i]);
        return ans;
    }

    static int cnt(int l, int r, int num) {
        int ans = 0;
        for(int i = l;i <= r;i++) if (a[i] == num) ans++;
        return ans;
    }

    static pair check(pair a) {
        if (a.l < 0 || a.r >= n) return new pair(0, 0, 0);
        return a;
    }

    static pair max(pair a, pair b) {
        a = check(a);
        b = check(b);
        if (a.ans > b.ans) return a;
        return b;
    }

    static void scan() throws IOException {
        n = sc.nextInt();
        char h[] = sc.next().toCharArray();
        a = new int [n];
        for(int i = 0;i < n;i++) {
            a[i] = (h[i] == '(' ? 1 : -1);
            if (i != 0) a[i] += a[i - 1];
        }
    }

    static pair zero() {
        return new pair(0, 0, cnt(0, n - 1, min()));
    }

    static pair plus() {
        int min = min();
        int l = inf;
        int r = -1;
        for(int i = 0;i < n;i++) {
            if (l == inf && a[i] == min) l = i;
            if (a[i] == min) r = i;
        }

        return max(plus1(l, r, min), plus2(l, r, min));
    }

    static pair plus1(int l, int r, int min) {
        int ans = cnt(0, l - 1, min + 1) + cnt(r + 1, n - 1, min + 1);
        return new pair(l, r + 1, ans);
    }

    static pair plus2(int l, int r, int min) {
        int l1 = l;
        int r1 = r;
        for(int i = 0;i < n;i++) {
            if (a[i] == min + 1 && l1 > i) l1 = i;
            if (a[i] == min + 1 && r1 < i) r1 = i;
        }

        int ans = cnt(0, n - 1, min);
        for(int i = 0;i < n;i++) {
            if ((i < l1 || i > r1) && a[i] == min + 2) ans++;
        }

        return new pair(l1, r1 + 1, ans);
    }

    static pair minus() {
        int min = min();
        int cnt = cnt(0, n - 1, min);
        int l = 0;
        pair ans = new pair(0, 0, 0);
        for(int i = 0;i < n;i++) {
            if (a[i] == min) {
                ans = max(ans, minus(l, i - 1, min, cnt));
                l = i + 1;
            }
        }
        return ans;
    }

    static pair minus(int l, int r, int min, int cnt) {
        int cnt1 = 0;
        int cnt2 = 0;
        pair ans = new pair(0, 0, 0);
        int l1 = l;
        for(int i = l;i <= r;i++) {
            if (a[i] == min + 1) {
                cnt1++;
                ans = max(ans, minus2(l1, i - 1, min, cnt));
                l1 = i + 1;
            }

            if (a[i] == min + 2) cnt2++;

        }

        ans = max(ans, minus2(l1, r, min, cnt));

        if (cnt1 > 0) return max(new pair(l, r + 1, cnt1), ans);
        return new pair(l, r + 1, cnt + cnt2);
    }

    static pair minus2(int l, int r, int min, int cnt) {
        return new pair(l, r + 1, cnt(l, r, min + 2) + cnt);
    }

    public static void main(String[] args) throws IOException {
        sc = new Scanner(System.in);
        pw = new PrintWriter(System.out);
        scan();
        if (a[n - 1] != 0) {
            System.out.println(0);
            System.out.println(1 + " " + 1);
            return;
        }
        pair ans = max(zero(), max(plus(), minus()));
        pw.println(ans.ans);
        pw.println(ans.l + 1 + " " + (ans.r + 1));

        pw.close();
    }

    static Scanner sc;
    static PrintWriter pw;

    static class Scanner {
        BufferedReader br;
        StringTokenizer st = new StringTokenizer("");

        Scanner(InputStream in) throws FileNotFoundException {
            br = new BufferedReader(new InputStreamReader(in));
        }

        Scanner(String in) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(in));
        }

        String next() throws IOException {
            while (!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}

class pair {
    int l, r, ans;

    pair(int l, int r, int ans) {
        this.l = l;
        this.r = r;
        this.ans = ans;
    }

    pair() {}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.Arrays;

public class Solution {
	public static void main(String[] args) throws IOException {
	    // Read inputs
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(br.readLine());
		String s = st.nextToken();
		int[] t = new int[n];
		int min = 0;
		int numL = 0;
		for(int i = 0; i< n; i++){
		    t[i] = i > 0 ? t[i-1] : 0;
		    char c = s.charAt(i);
		    if(c == '(') {
		        t[i]++;
		        numL++;
		    } else {
		        t[i]--;
		        if(t[i] < min) {
		            min = t[i];
		        }
		    }
		}
		if (n%2 != 0 || numL*2 != n) {
		    System.out.println(0);
		    System.out.println("1 1");
		    return;
		}
		int base = 0, bb = 0;
		int bs = 1, be = 1;
		int mi = 0;
		for (int i = 0; i <n; i++) {
		    if(t[i] == min){
		        base++;
		        mi = i;
		    }
		    t[i] -= min;
		}
		bb = base;
		// Look for those at height 1
		for (int i = 0; i < n; i++) {
    		int cb = 0;
    		int start = mi;
    		int end = mi;
		    while(t[(mi+i)%n]>0) {
		        if(t[(mi+i-1)%n]==0) start = (mi+i)%n;
		        if(t[(mi+i)%n]==1) cb++;
		        i++;
		    }
	        end = (mi+i)%n;
		    if(cb>bb){
		        be = end + 1;
		        bs = start + 1;
		        bb = cb;
		    }
		}

		// Look for those at height 2
		for (int i = 0; i < n; i++) {
    		int cb = 0;
    		int start = mi;
    		int end = mi;
		    while(t[(mi+i)%n]>1) {
		        if(t[(mi+i-1)%n]==1) start = (mi+i)%n;
		        if(t[(mi+i)%n]==2) cb++;
		        i++;
		    }
	        end = (mi+i)%n;
		    if(cb + base >bb){
		        be = end + 1;
		        bs = start + 1;
		        bb = cb + base;
		    }
		}
		System.out.println(bb);
		System.out.println(bs + " " + be);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by Katushka on 23.10.2019.
 */
public class TheWorldIsJustProgrammingTask {

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);

        int n = in.nextInt();
        String s = in.nextString();

        if (n % 2 != 0) {
            System.out.println("0");
            System.out.println("1 1");
            return;
        }

        int[] grow = new int[n];
        int current = 0;
        int min = 0;
        int minIndex = n - 1;

//        char t = s.charAt(327);
//        char t2 = s.charAt(373);
//        s = s.substring(0, 327) + t2 + s.substring(328, 373) + t + s.substring(374);

        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == '(') {
                current ++;
            } else {
                current --;
            }
            grow[i] = current;
            if (min > grow[i]) {
                min = grow[i];
                minIndex = i;
            }
        }

//        int zerosCount = 0;
//        for (int i = 0; i < n; i++) {
//            if (grow[i] == min) {
//                zerosCount++;
//            }
//        }
//        System.out.println("zeros = " + zerosCount);

        if (current != 0) {
            System.out.println("0");
            System.out.println("1 1");
            return;
        }

        int zeros = 1;

        int bestFirstTwo = -1;
        int bestLastTwo = -1;
        int maxTwos = 0;
        int firstTwo = -1;
        int currentTwos = 0;

        int ones = 0;
        int maxOnes = 0;
        int bestFirstZero = minIndex;
        int bestLastZero = -1;
        int lastZero = minIndex;

        for (int i = (minIndex + 1) % n; i != minIndex; i = (i + 1) % n) {
            if (grow[i] == min) {
                zeros++;
                if (ones > maxOnes) {
                    bestFirstZero = (lastZero + 1) % n;
                    bestLastZero = i;
                    maxOnes = ones;
                }
                ones = 0;
                lastZero = i;
            }
            if (grow[i] - min == 2) {
                if (firstTwo == -1) {
                    firstTwo = i;
                }
                currentTwos++;
            }
            if (grow[i] - min == 1) {
                ones++;

                if (firstTwo != -1) {
                    if (currentTwos > maxTwos) {
                        maxTwos = currentTwos;
                        bestFirstTwo = firstTwo;
                        bestLastTwo = i;

                    }
                }

                firstTwo = -1;
                currentTwos = 0;
            }
        }

        if (ones > maxOnes) {
            maxOnes = ones;

            bestFirstZero = lastZero + 1;
            bestLastZero = minIndex;
        }

        if (zeros + maxTwos > maxOnes) {
            System.out.println(zeros + maxTwos);
            if (bestFirstTwo == -1 && bestLastTwo == -1) {
                System.out.println("1 1");
            } else {
                System.out.println((bestFirstTwo + 1) + " " + (bestLastTwo + 1));
            }
        } else {
            System.out.println(maxOnes);
            if (bestLastZero == -1) {
                System.out.println((minIndex + 1) + " " + ((minIndex + 1 + n) % n + 1));
            } else {
                System.out.println((bestFirstZero + 1) + " " + (bestLastZero + 1));
            }

        }
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    final String str = reader.readLine();
                    tokenizer = new StringTokenizer(str);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextString() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public char nextChar() {
            return next().charAt(0);
        }
    }
}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Locale;
import java.util.StringTokenizer;

public class Solution implements Runnable {

	private PrintStream out;
	private BufferedReader in;
	private StringTokenizer st;

	public void solve() throws IOException {
		long time0 = System.currentTimeMillis();

		int n = nextInt();
		String s = next();
		Answer answer = solve(n, s);
		out.println(answer.answer);
		out.println((answer.l + 1) + " " + (answer.r + 1));

		System.err.println("time: " + (System.currentTimeMillis() - time0));
	}

	private Answer solve(int n, String str) {
		boolean[] s = new boolean[n];
		for (int i = 0; i < n; i++) {
			if (str.charAt(i) == '(') {
				s[i] = true;
			} else if (str.charAt(i) == ')') {
				s[i] = false;
			} else {
				throw new RuntimeException("Botva in input!");
			}
		}
		int[] sum = new int[n];
		int sacc = 0;
		for (int i = 0; i < n; i++) {
			sum[i] = sacc;
			sacc += s[i] ? 1 : -1;
		}
		Answer answer = new Answer(0, 0, 0);
		if (sacc != 0) {
			return answer;
		}
		int min = 0;
		int mincnt = 1;
		for (int i = 1; i < n; i++) {
			if (min > sum[i]) {
				min = sum[i];
				mincnt = 1;
			} else if (min == sum[i]) {
				mincnt += 1;
			}
		}
		answer.update(mincnt, 0, 0);
		int i = 0;
		while (sum[i] > min) {
			i++;
		}
		while (i < n) {
			int j = 1;
			while (sum[(i + j) % n] > min) {
				j++;
			}
			int first = 0;
			for (int k = 1; k < j; k++) {
				if (sum[(i + k) % n] == min + 1) {
					first += 1;
				}
			}
			answer.update(first, i, (i + j - 1) % n);
			int second = 0;
			int secondfirst = 1;
			for (int k = 2; k < j; k++) {
				if (sum[(i + k) % n] == min + 1) {
					answer.update(mincnt + second, (i + secondfirst) % n, (i + k - 1) % n);
					second = 0;
					secondfirst = k;
				}
				if (sum[(i + k) % n] == min + 2) {
					second += 1;
				}
			}
			i = i + j;
		}
		return answer;
	}

	private static final class Answer {
		private int answer;
		private int l;
		private int r;
		private Answer(int answer, int l, int r) {
			this.answer = answer;
			this.l = l;
			this.r = r;
		}
		private void update(int answer, int l, int r) {
			if (this.answer < answer) {
				this.answer = answer;
				this.l = l;
				this.r = r;
			}
		}
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	public String next() throws IOException {
		while (!st.hasMoreTokens()) {
			String line = in.readLine();
			if (line == null) {
				return null;
			}
			st = new StringTokenizer(line);
		}
		return st.nextToken();
	}

	@Override
	public void run() {
		try {
			solve();
			out.close();
		} catch (Throwable e) {
			throw new RuntimeException(e);
		}
	}

	public Solution(String name) throws IOException {
		Locale.setDefault(Locale.US);
		if (name == null) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintStream(new BufferedOutputStream(System.out));
		} else {
			in = new BufferedReader(new InputStreamReader(new FileInputStream(name + ".in")));
			out = new PrintStream(new BufferedOutputStream(new FileOutputStream(name + ".out")));
		}
		st = new StringTokenizer("");
	}

	public static void main(String[] args) throws IOException {
		new Thread(new Solution(null)).start();
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
import java.io.UncheckedIOException;
import java.nio.charset.Charset;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        LightWriter out = new LightWriter(outputStream);
        BTheWorldIsJustAProgrammingTaskHardVersion solver = new BTheWorldIsJustAProgrammingTaskHardVersion();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTheWorldIsJustAProgrammingTaskHardVersion {
        public void solve(int testNumber, LightScanner in, LightWriter out) {
            // out.setBoolLabel(LightWriter.BoolLabel.YES_NO_FIRST_UP);
            int n = in.ints();
            char[] s = in.string().toCharArray();
            int close = 0;
            for (int i = 0; i < n; i++) close += s[i] - '(';
            if (close * 2 != n) {
                out.ans(0).ln()
                        .ans(1).ans(1).ln();
                return;
            }

            int base = 0;
            int[] depth = new int[n], another = new int[n];
            int[][] sum = new int[2][2 * n + 1];
            {
                int d = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(') d++;
                    else d--;
                    base = Math.min(base, d);
                    depth[i] = d;
                }
            }
            {
                int offset = -1;
                for (int i = 0; i < n; i++) {
                    if (depth[i] - base == 0) {
                        offset = (i + 1) % n;
                        break;
                    }
                }
                Stack<Integer> st = new Stack<>();
                for (int j = 0; j < n; j++) {
                    int i = (offset + j) % n;
                    if (s[i] == '(') st.push(i);
                    else {
                        int a = st.pop();
                        another[a] = i < a ? i + n : i;
                        another[i] = a;
                    }
                }
            }

            {
                for (int i = 0; i < 2 * n; i++) {
                    if (s[i % n] == '(' || depth[i % n] - base != 1) {
                        sum[0][i + 1] = sum[0][i];
                    } else sum[0][i + 1] = sum[0][i] + 1;
                    if (s[i % n] == '(' || depth[i % n] - base != 2) {
                        sum[1][i + 1] = sum[1][i];
                    } else sum[1][i + 1] = sum[1][i] + 1;
                }
            }

            int a = 0, b = 0, ans = eval(s, a, b);
            {
                int cnt = -1, x = 0, y = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(' && depth[i] - base == 1) {
                        int c = sum[0][another[i]] - sum[0][i + 1];
                        if (c > cnt) {
                            cnt = c;
                            x = i;
                            y = another[i] % n;
                        }
                    }
                }
                if (cnt >= 0) {
                    int t = eval(s, x, y);
                    if (t > ans) {
                        ans = t;
                        a = x;
                        b = y;
                    }
                }
            }
            {
                //System.out.println(Arrays.toString(sum[1]));
                int cnt = -1, x = 0, y = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(' && depth[i] - base == 2) {
                        int c = sum[1][another[i]] - sum[1][i + 1];
                        //System.out.println("FOUND: " + i + "~" + (another[i]) + ":" + (sum[1][another[i]] - sum[1][i + 1]));
                        if (c > cnt) {
                            cnt = c;
                            x = i;
                            y = another[i] % n;
                        }
                    }
                }
                if (cnt >= 0) {
                    int t = eval(s, x, y);
                    if (t > ans) {
                        ans = t;
                        a = x;
                        b = y;
                    }
                }
            }

            out.ans(ans).ln()
                    .ans(Math.min(a, b) + 1).ans(Math.max(a, b) + 1).ln();

            //System.out.println(Arrays.toString(cnt));
        }

        private static void swap(char[] s, int x, int y) {
            char t = s[x];
            s[x] = s[y];
            s[y] = t;
        }

        private static int eval(char[] s, int x, int y) {
            swap(s, x, y);
            int base = 0;
            {
                int d = 0;
                for (char c : s) {
                    if (c == '(') d++;
                    else d--;
                    base = Math.min(base, d);
                }
            }

            int ans = 0;
            {
                int d = 0;
                for (char c : s) {
                    if (c == '(') d++;
                    else d--;
                    if (c == ')' && d - base == 0) ans++;
                }
            }
            swap(s, x, y);
            return ans;
        }

    }

    static class LightWriter implements AutoCloseable {
        private final Writer out;
        private boolean autoflush = false;
        private boolean breaked = true;

        public LightWriter(Writer out) {
            this.out = out;
        }

        public LightWriter(OutputStream out) {
            this(new BufferedWriter(new OutputStreamWriter(out, Charset.defaultCharset())));
        }

        public LightWriter print(char c) {
            try {
                out.write(c);
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter print(String s) {
            try {
                out.write(s, 0, s.length());
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter ans(String s) {
            if (!breaked) {
                print(' ');
            }
            return print(s);
        }

        public LightWriter ans(int i) {
            return ans(Integer.toString(i));
        }

        public LightWriter ln() {
            print(System.lineSeparator());
            breaked = true;
            if (autoflush) {
                try {
                    out.flush();
                } catch (IOException ex) {
                    throw new UncheckedIOException(ex);
                }
            }
            return this;
        }

        public void close() {
            try {
                out.close();
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

    }
}

/*
 ID: tommatt1
 LANG: JAVA
 TASK:
*/
import java.util.*;
import java.io.*;
public class cf1239b{

	public static void main(String[] args)throws IOException {
		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		//BufferedReader bf=new BufferedReader(new FileReader("cf1239b.in"));
		//PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("cf1239b.out")));
		StringTokenizer st=new StringTokenizer(bf.readLine());
		int n=Integer.parseInt(st.nextToken());
		String s=bf.readLine();
		int[] a=new int[2*n+1];
		for(int i=0;i<n;i++) {
			if(s.charAt(i)=='(') {
				a[i+1]=1;
			}
			else {
				a[i+1]=-1;
			}
		}
		for(int i=n+1;i<2*n+1;i++) {
			a[i]=a[i-n];
		}
		int mn=0;
		int x=0;
		int zero=0;
		for(int i=1;i<=n;i++) {
			zero+=a[i];
			if(zero<mn) {
				mn=zero;
				x=i;
			}
		}
		if(zero!=0) {
			out.println(0);
			out.println(1+" "+1);
			out.close();
			return;
		}
		x++;
		int top=0;
		int ans=0;
		int[] stk=new int[n+1];
		int[] dep=new int[2*n+1];
		int[] psum=new int[2*n+1];
		int[] dsum=new int[2*n+1];
		int[] p=new int[2*n+1];
		for(int i=x;i<x+n;i++){
			if(a[i]==1) stk[++top]=i;
			else {
				psum[i]=dsum[top];
				dsum[top]=0;
				p[i]=stk[top--];
				dsum[top]++;
				dep[i]=top;
			}
			if(top==0) ans++;
		}
		int old=ans;
		int l=0;
		int r=0;
		for(int i=x+1;i<x+n;i++) {
			if(a[i]==-1) {
				if(dep[i]==0&&ans<psum[i]+1) {
					ans=psum[i]+1;
					l=p[i];
					r=i;
				}
				if(dep[i]==1&&ans<psum[i]+1+old) {
					ans=psum[i]+1+old;
					l=p[i];
					r=i;
				}
			}
		}
		out.println(ans);
		int lans=l%n;
		if(lans==0) lans+=n;
		int rans=r%n;
		if(rans==0) rans+=n;
		out.println(lans+" "+rans);
		out.close();
	}

}

import java.io.BufferedInputStream;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Locale;
import java.util.Scanner;

public class TaskD {
    private static final String QUICK_ANSWER = "NO";
    private final Scanner in;
    private final StringBuilder out;
    private final int n;
    private final char[] chars;
    private final boolean[] up;
    int minPos;

    public TaskD(Scanner in, StringBuilder out) throws QuickAnswer {
        this.in = in;
        this.out = out;
        n = nextInt();
        chars = nextString().toCharArray();
        int lev = 0;
        int minLev = 0;
        int minPos = 0;
        for (int i = 0; i < n; i++) {
            if (chars[i] == '(') ++lev;
            else --lev;
            if (lev < minLev) {
                minLev = lev;
                minPos = i + 1;
            }
        }
        if (lev != 0) {
            quickAnswer("0\n1 1");
        }
        minPos %= n;
        this.minPos = minPos;
        up = new boolean[n];
        for (int i = 0; i < n; i++) {
            up[i] = chars[(i + minPos) % n] == '(';
        }
    }

    public void solve() throws QuickAnswer {
        int lev = 0;
        int i1 = 0;
        int i2 = 0;
        int bonus = 0;
        int istart = -1;
        int b = 1;
        int cnt0 = 0;
        int cnt1 = 0;
        for (int i = 0; i < n; i++) {
            if (up[i]) lev++;
            else lev--;
            if (lev == 0) ++cnt0;
            if (lev == 1) ++cnt1;
            if (lev == 2) {
                if (up[i]) istart = i;
                else ++b;
            } else if (lev == 1 && !up[i]) {
                if (b > bonus) {
                    i1 = istart;
                    i2 = i;
                    bonus = b;
                }
                istart = -1;
                b = 1;
            }
        }
        up[i1] = false;
        up[i2] = true;
        lev = 0;
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (up[i]) lev++;
            else lev--;
            if (lev == 0) ++cnt;
        }
        if (cnt0 == 1 && cnt1 > cnt) {
            cnt = cnt1;
            i1 = 0;
            i2 = n - 1;
        }

        println(cnt);
        print(1 + (i1 + minPos) % n, 1 + (i2 + minPos) % n);

    }

    // Common functions

    void quickAnswer(String answer) throws QuickAnswer {
        throw new QuickAnswer(answer);
    }

    void quickAnswer() throws QuickAnswer {
        quickAnswer(QUICK_ANSWER);
    }

    static class QuickAnswer extends Exception {
        private String answer;

        public QuickAnswer(String answer) {
            this.answer = answer;
        }
    }

    void print(Object... args) {
        String prefix = "";
        for (Object arg : args) {
            out.append(prefix);
            out.append(arg);
            prefix = " ";
        }
    }

    void println(Object... args) {
        print(args);
        out.append("\n");
    }

    void printsp(Object... args) {
        print(args);
        out.append(" ");
    }

    int nextInt() {
        return in.nextInt();
    }

    long nextLong() {
        return in.nextLong();
    }

    String nextString() {
        String res = in.nextLine();
        return res.trim().isEmpty() ? in.nextLine() : res;
    }

    int[] nextInts(int count) {
        int[] res = new int[count];
        for (int i = 0; i < count; ++i) {
            res[i] = in.nextInt();
        }
        return res;
    }

    long[] nextLongs(int count) {
        long[] res = new long[count];
        for (int i = 0; i < count; ++i) {
            res[i] = in.nextInt();
        }
        return res;
    }

    public static void main(String[] args) {
        doMain(System.in, System.out);
    }

    static void doMain(InputStream inStream, PrintStream outStream) {
        Scanner in = new Scanner(new BufferedInputStream(inStream)).useLocale(Locale.ENGLISH);
        StringBuilder totalOut = new StringBuilder();
        int count = 1;
        //count = in.nextInt();
        while (count-- > 0) {
            try {
                StringBuilder out = new StringBuilder();
                new TaskD(in, out).solve();
                totalOut.append(out.toString());
            } catch (QuickAnswer e) {
                totalOut.append(e.answer);
            }
            if (count > 0) {
                totalOut.append("\n");
            }
        }
        outStream.print(totalOut.toString());
    }
}

/**
 * BaZ :D
 */
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main
{
    static MyScanner scan;
    static PrintWriter pw;
    static long MOD = 1_000_000_007;
    static long INF = 1_000_000_000_000_000_000L;
    static long inf = 2_000_000_000;
    public static void main(String[] args) {
        new Thread(null, null, "BaZ", 1 << 27) {
            public void run() {
                try {
                    solve();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static int idx1, idx2;
    static void solve() throws IOException
    {
        //initIo(true);
        initIo(false);
        StringBuilder sb = new StringBuilder();
        int n = ni();
        char c[] = ne().toCharArray();
        int bal[] = new int[n];
        int open = 0;
        for(int i=0;i<n;++i) {
            if(c[i] == '(') {
                bal[i]++;
                open++;
            }
            else {
                bal[i]--;
            }
            if(i-1>=0) {
                bal[i]+=bal[i-1];
            }
        }
        if(open != n - open) {
            pl("0\n1 1");
            System.exit(0);
        }
        int min = Integer.MAX_VALUE, at = -1;
        for(int i=0;i<n;++i) {
            if(bal[i]<min) {
                min = bal[i];
                at = i;
            }
        }
        //pa("bal", bal);
        int arr[] = new int[n];
        int ptr = 0;
        for(int i=at+1;i<n;++i) {
            arr[ptr++] = bal[i] - min;
        }
        for(int i=0;i<=at;++i) {
            arr[ptr++] = bal[i] - min;
        }
        //pa("arr", arr);
        int max = -1, ans_idx1 = -1, ans_idx2 = -1;
        int zero = calc(arr,0,n,false);
        if(zero>max) {
            max = zero;
            ans_idx1 = idx1;
            ans_idx2 = idx2;
        }
        int one = calc(arr,1,n,false);
        if(one>max) {
            max = one;
            ans_idx1 = idx1;
            ans_idx2 = idx2;
        }
        int two = calc(arr,2,n,true);
        if(two>max) {
            max = two;
            ans_idx1 = idx1;
            ans_idx2 = idx2;
        }
        pl(max);
        pl((1+getOriginalIndex(at+1 == n ? 0 : at+1, n, ans_idx1)) + " " + (1+getOriginalIndex(at+1 == n ? 0 : at+1, n, ans_idx2)));
        pw.flush();
        pw.close();
    }
    static int getOriginalIndex(int from_where, int n, int idx) {
        if(idx<=n-1-from_where) {
            return from_where + idx;
        }
        else {
            return idx - (n-from_where);
        }
    }
    static int calc(int arr[], int k, int n, boolean shouldAdd) {
        int till[] = new int[n];
        int cum[] = new int[n];
        int pref[] = new int[n];
        int suff[] = new int[n];
        for(int i=n-1;i>=0;--i) {
            if(arr[i] == 0) {
                ++suff[i];
            }
            if(i+1<n) {
                suff[i]+=suff[i+1];
            }
        }
        for(int i=0;i<n;++i) {
            if(arr[i] == k) {
                cum[i]++;
            }
            if(arr[i] == 0) {
                ++pref[i];
            }
            if(i>0) {
                cum[i]+=cum[i-1];
                pref[i]+=pref[i-1];
            }
        }
        for(int i=n-1;i>=0;--i) {
            if(arr[i] >= k) {
                till[i] = (i+1 < n  ? till[i+1] : n);
            }
            else {
                till[i] = i;
            }
        }
        int max = -1;
        for(int i=0;i<n;++i) {
            if(till[i]==i) {
                continue;
            }
            int ispe = (till[i] - 1 > 0 ? cum[till[i] - 1] : 0) - (i > 0 ? cum[i-1] : 0);
            if(shouldAdd) {
                ispe+=(i-1>0 ? pref[i-1] : 0);
                ispe+=(till[i] < n ? suff[till[i]] : 0);
            }
            if(max<ispe) {
                idx1 = i;
                idx2 = min(n-1, till[i]);
                max = ispe;
            }
        }
        return max;
    }
    static void initIo(boolean isFileIO) throws IOException {
        scan = new MyScanner(isFileIO);
        if(isFileIO) {
            pw = new PrintWriter("/Users/amandeep/Desktop/output.txt");
        }
        else {
            pw = new PrintWriter(System.out, true);
        }
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static String ne() throws IOException
    {
        return scan.next();
    }
    static String nel() throws IOException
    {
        return scan.nextLine();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    static void pa(String arrayName, Object[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(Object o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, int[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(int o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, long[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(long o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, char[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(char o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, double[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(double o : arr[i])
                p(o);
            pl();
        }
    }
    static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;
        MyScanner(boolean readingFromFile) throws IOException
        {
            if(readingFromFile) {
                br = new BufferedReader(new FileReader("/Users/amandeep/Desktop/input.txt"));
            }
            else {
                br = new BufferedReader(new InputStreamReader(System.in));
            }
        }
        String nextLine()throws IOException
        {
            return br.readLine();
        }
        String next() throws IOException
        {
            if(st==null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        int nextInt() throws IOException
        {
            return Integer.parseInt(next());
        }
        long nextLong() throws IOException
        {
            return Long.parseLong(next());
        }
        double nextDouble() throws IOException
        {
            return Double.parseDouble(next());
        }
    }
}

/**
 * BaZ :D
 */
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main
{
    static MyScanner scan;
    static PrintWriter pw;
    static long MOD = 1_000_000_007;
    static long INF = 1_000_000_000_000_000_000L;
    static long inf = 2_000_000_000;
    public static void main(String[] args) {
        new Thread(null, null, "BaZ", 1 << 27) {
            public void run() {
                try {
                    solve();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static int idx1, idx2;
    static char c[];
    static void solve() throws IOException
    {
        //initIo(true);
        initIo(false);
        StringBuilder sb = new StringBuilder();
        int n = ni();
        c = ne().toCharArray();
        int bal[] = new int[n];
        int open = 0;
        for(int i=0;i<n;++i) {
            if(c[i] == '(') {
                bal[i]++;
                open++;
            }
            else {
                bal[i]--;
            }
            if(i-1>=0) {
                bal[i]+=bal[i-1];
            }
        }
        if(open != n - open) {
            pl("0\n1 1");
            System.exit(0);
        }
        int min = Integer.MAX_VALUE, at = -1;
        for(int i=0;i<n;++i) {
            if(bal[i]<min) {
                min = bal[i];
                at = i;
            }
        }
        //pa("bal", bal);
        int arr[] = new int[n];
        int ptr = 0;
        for(int i=at+1;i<n;++i) {
            arr[ptr++] = bal[i] - min;
        }
        for(int i=0;i<=at;++i) {
            arr[ptr++] = bal[i] - min;
        }
        //pa("arr", arr);
        int max = -1, ans_idx1 = -1, ans_idx2 = -1;
        int zero = calc(arr,0,n,false, (at+1 ==n ? 0 : at+1));
        if(zero>max) {
            max = zero;
            ans_idx1 = idx1;
            ans_idx2 = idx2;
        }
        int one = calc(arr,1,n,false, (at+1 ==n ? 0 : at+1));
        if(one>max) {
            max = one;
            ans_idx1 = idx1;
            ans_idx2 = idx2;
        }
        int two = calc(arr,2,n,true, (at+1 ==n ? 0 : at+1));
        if(two>max) {
            max = two;
            ans_idx1 = idx1;
            ans_idx2 = idx2;
        }
        pl(max);
        pl((1+getOriginalIndex(at+1 == n ? 0 : at+1, n, ans_idx1)) + " " + (1+getOriginalIndex(at+1 == n ? 0 : at+1, n, ans_idx2)));
        pw.flush();
        pw.close();
    }
    static int getOriginalIndex(int from_where, int n, int idx) {
        if(idx<=n-1-from_where) {
            return from_where + idx;
        }
        else {
            return idx - (n-from_where);
        }
    }
    static int calc(int arr[], int k, int n, boolean shouldAdd, int from_where) {
        int till[] = new int[n];
        int cum[] = new int[n];
        int pref[] = new int[n];
        int suff[] = new int[n];
        for(int i=n-1;i>=0;--i) {
            if(arr[i] == 0) {
                ++suff[i];
            }
            if(i+1<n) {
                suff[i]+=suff[i+1];
            }
        }
        for(int i=0;i<n;++i) {
            if(arr[i] == k) {
                cum[i]++;
            }
            if(arr[i] == 0) {
                ++pref[i];
            }
            if(i>0) {
                cum[i]+=cum[i-1];
                pref[i]+=pref[i-1];
            }
        }
        for(int i=n-1;i>=0;--i) {
            if(arr[i] >= k) {
                till[i] = (i+1 < n  ? till[i+1] : n);
            }
            else {
                till[i] = i;
            }
        }
        int max = -1;
        for(int i=0;i<n;++i) {
            if(till[i]==i) {
                continue;
            }
            if(c[getOriginalIndex(from_where, n, i)] == ')') {
                continue;
            }
            int ispe = (till[i] - 1 > 0 ? cum[till[i] - 1] : 0) - (i > 0 ? cum[i-1] : 0);
            if(shouldAdd) {
                ispe+=(i-1>0 ? pref[i-1] : 0);
                ispe+=(till[i] < n ? suff[till[i]] : 0);
            }
            if(max<ispe) {
                idx1 = i;
                idx2 = min(n-1, till[i]);
                max = ispe;
            }
        }
        return max;
    }
    static void initIo(boolean isFileIO) throws IOException {
        scan = new MyScanner(isFileIO);
        if(isFileIO) {
            pw = new PrintWriter("/Users/amandeep/Desktop/output.txt");
        }
        else {
            pw = new PrintWriter(System.out, true);
        }
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static String ne() throws IOException
    {
        return scan.next();
    }
    static String nel() throws IOException
    {
        return scan.nextLine();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    static void pa(String arrayName, Object[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(Object o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, int[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(int o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, long[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(long o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, char[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(char o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, double[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(double o : arr[i])
                p(o);
            pl();
        }
    }
    static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;
        MyScanner(boolean readingFromFile) throws IOException
        {
            if(readingFromFile) {
                br = new BufferedReader(new FileReader("/Users/amandeep/Desktop/input.txt"));
            }
            else {
                br = new BufferedReader(new InputStreamReader(System.in));
            }
        }
        String nextLine()throws IOException
        {
            return br.readLine();
        }
        String next() throws IOException
        {
            if(st==null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        int nextInt() throws IOException
        {
            return Integer.parseInt(next());
        }
        long nextLong() throws IOException
        {
            return Long.parseLong(next());
        }
        double nextDouble() throws IOException
        {
            return Double.parseDouble(next());
        }
    }
}

import java.io.*;
import java.util.*;

public class Main {
    static int inf = (int) 1e9 + 7;
    static int n, a[];

    static int min() {
        int ans = inf;
        for(int i = 0;i < n;i++) ans = Math.min(ans, a[i]);
        return ans;
    }

    static int cnt(int l, int r, int num) {
        int ans = 0;
        for(int i = l;i <= r;i++) if (a[i] == num) ans++;
        return ans;
    }

    static pair check(pair a) {
        if (a.l < 0 || a.r >= n) return new pair(0, 0, 0);
        return a;
    }

    static pair max(pair a, pair b) {
        a = check(a);
        b = check(b);
        if (a.ans > b.ans) return a;
        return b;
    }

    static void scan() throws IOException {
        n = sc.nextInt();
        char h[] = sc.next().toCharArray();
        a = new int [n];
        for(int i = 0;i < n;i++) {
            a[i] = (h[i] == '(' ? 1 : -1);
            if (i != 0) a[i] += a[i - 1];
        }
    }

    static pair zero() {
        return new pair(0, 0, cnt(0, n - 1, min()));
    }

    static pair plus() {
        int min = min();
        int l = inf;
        int r = -1;
        for(int i = 0;i < n;i++) {
            if (l == inf && a[i] == min) l = i;
            if (a[i] == min) r = i;
        }

        return max(plus1(l, r, min), plus2(l, r, min));
    }

    static pair plus1(int l, int r, int min) {
        int ans = cnt(0, l - 1, min + 1) + cnt(r + 1, n - 1, min + 1);
        return new pair(l, r + 1, ans);
    }

    static pair plus2(int l, int r, int min) {
        int l1 = l;
        int r1 = r;
        for(int i = 0;i < n;i++) {
            if (a[i] == min + 1 && l1 > i) l1 = i;
            if (a[i] == min + 1 && r1 < i) r1 = i;
        }

        int ans = cnt(0, n - 1, min);
        for(int i = 0;i < n;i++) {
            if ((i < l1 || i > r1) && a[i] == min + 2) ans++;
        }

        return new pair(l1, r1 + 1, ans);
    }

    static pair minus() {
        int min = min();
        int cnt = cnt(0, n - 1, min);
        int l = 0;
        pair ans = new pair(0, 0, 0);
        for(int i = 0;i < n;i++) {
            if (a[i] == min) {
                ans = max(ans, minus(l, i - 1, min, cnt));
                l = i + 1;
            }
        }
        return ans;
    }

    static pair minus(int l, int r, int min, int cnt) {
        int cnt1 = 0;
        int cnt2 = 0;
        for(int i = l;i <= r;i++) {
            if (a[i] == min + 1) cnt1++;
            if (a[i] == min + 2) cnt2++;
        }

        if (cnt1 > 0) return new pair(l, r + 1, cnt1);
        return new pair(l, r + 1, cnt + cnt2);
    }

    public static void main(String[] args) throws IOException {
        sc = new Scanner(System.in);
        pw = new PrintWriter(System.out);
        scan();
        if (a[n - 1] != 0) {
            System.out.println(0);
            System.out.println(1 + " " + 1);
            return;
        }
        pair ans = max(zero(), max(plus(), minus()));
        pw.println(ans.ans);
        pw.println(ans.l + 1 + " " + (ans.r + 1));

        pw.close();
    }

    static Scanner sc;
    static PrintWriter pw;

    static class Scanner {
        BufferedReader br;
        StringTokenizer st = new StringTokenizer("");

        Scanner(InputStream in) throws FileNotFoundException {
            br = new BufferedReader(new InputStreamReader(in));
        }

        Scanner(String in) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(in));
        }

        String next() throws IOException {
            while (!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}

class pair {
    int l, r, ans;

    pair(int l, int r, int ans) {
        this.l = l;
        this.r = r;
        this.ans = ans;
    }

    pair() {}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.nio.charset.Charset;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        LightWriter out = new LightWriter(outputStream);
        BTheWorldIsJustAProgrammingTaskHardVersion solver = new BTheWorldIsJustAProgrammingTaskHardVersion();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTheWorldIsJustAProgrammingTaskHardVersion {
        public void solve(int testNumber, LightScanner in, LightWriter out) {
            // out.setBoolLabel(LightWriter.BoolLabel.YES_NO_FIRST_UP);
            int n = in.ints();
            char[] s = in.string().toCharArray();
            int close = 0;
            for (int i = 0; i < n; i++) close += s[i] - '(';
            if (close * 2 != n) {
                out.ans(0).ln().ans(1).ans(1).ln();
                return;
            }
            int base = 0;
            int[] depth = new int[n];
            {
                int d = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(') d++;
                    else d--;
                    base = Math.min(base, d);
                    depth[i] = d;
                }
            }

            int[] cnt = new int[Math.max(n / 2 + 1, 3)];
            for (int i = 0; i < n; i++) {
                if (s[i] == '(') cnt[depth[i] - base]++;
            }

            int x, y;
            if (cnt[1] == 1) {
                x = -1;
                y = -1;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(' && depth[i] - base == 1) x = i;
                    if (s[i] == ')' && depth[i] - base == 0) y = i;
                }
                s[x] = ')';
                s[y] = '(';
            } else if (cnt[2] >= 1) {
                x = y = -1;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(' && depth[i] - base == 2) {
                        x = i;
                        break;
                    }
                }
                for (int j = 0; j < n; j++) {
                    int i = (x + j) % n;
                    if (s[i] == ')' && depth[i] - base == 1) {
                        y = i;
                        break;
                    }
                }
                s[x] = ')';
                s[y] = '(';
            } else {
                x = y = 0;
            }

            // base recalc
            base = 0;
            {
                int d = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(') d++;
                    else d--;
                    base = Math.min(base, d);
                }
            }

            // calc ans
            int ans = 0;
            {
                int d = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(') d++;
                    else d--;
                    if (d - base == 0) ans++;
                }
            }
            out.ans(ans).ln().ans(x + 1).ans(y + 1).ln();

            //System.out.println(Arrays.toString(cnt));
        }

    }

    static class LightWriter implements AutoCloseable {
        private final Writer out;
        private boolean autoflush = false;
        private boolean breaked = true;

        public LightWriter(Writer out) {
            this.out = out;
        }

        public LightWriter(OutputStream out) {
            this(new BufferedWriter(new OutputStreamWriter(out, Charset.defaultCharset())));
        }

        public LightWriter print(char c) {
            try {
                out.write(c);
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter print(String s) {
            try {
                out.write(s, 0, s.length());
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter ans(String s) {
            if (!breaked) {
                print(' ');
            }
            return print(s);
        }

        public LightWriter ans(int i) {
            return ans(Integer.toString(i));
        }

        public LightWriter ln() {
            print(System.lineSeparator());
            breaked = true;
            if (autoflush) {
                try {
                    out.flush();
                } catch (IOException ex) {
                    throw new UncheckedIOException(ex);
                }
            }
            return this;
        }

        public void close() {
            try {
                out.close();
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.nio.charset.Charset;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        LightWriter out = new LightWriter(outputStream);
        BTheWorldIsJustAProgrammingTaskHardVersion solver = new BTheWorldIsJustAProgrammingTaskHardVersion();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTheWorldIsJustAProgrammingTaskHardVersion {
        public void solve(int testNumber, LightScanner in, LightWriter out) {
            // out.setBoolLabel(LightWriter.BoolLabel.YES_NO_FIRST_UP);
            int n = in.ints();
            char[] s = in.string().toCharArray();
            int close = 0;
            for (int i = 0; i < n; i++) close += s[i] - '(';
            if (close * 2 != n) {
                out.ans(0).ln()
                        .ans(1).ans(1).ln();
                return;
            }

            int base = 0;
            int[] depth = new int[n];
            {
                int d = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(') d++;
                    else d--;
                    base = Math.min(base, d);
                    depth[i] = d;
                }
            }

            int[] cnt = new int[Math.max(n / 2 + 1, 3)];
            for (int i = 0; i < n; i++) {
                if (s[i] == '(') cnt[depth[i] - base]++;
            }

            int a = 0, b = 0, ans = eval(s);
            if (cnt[2] == 1) {
                int x = 0, y = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(' && depth[i] - base == 2) {
                        x = i;
                        break;
                    }
                }
                for (int j = 1; j < n; j++) {
                    int i = (x + j) % n;
                    if (s[i] == ')' && depth[i] - base == 1) {
                        y = i;
                        break;
                    }
                }

                swap(s, x, y);
                int t = eval(s);
                swap(s, x, y);
                if (t > ans) {
                    ans = t;
                    a = x;
                    b = y;
                }
            }

            if (cnt[1] >= 1) {
                int x = 0, y = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(' && depth[i] - base == 1) x = i;
                    if (s[i] == ')' && depth[i] - base == 0) y = i;
                }
                swap(s, x, y);
                int t = eval(s);
                swap(s, x, y);
                if (t > ans) {
                    ans = t;
                    a = x;
                    b = y;
                }
            }

            out.ans(ans).ln()
                    .ans(Math.min(a, b) + 1).ans(Math.max(a, b) + 1).ln();

            //System.out.println(Arrays.toString(cnt));
        }

        private static void swap(char[] s, int x, int y) {
            char t = s[x];
            s[x] = s[y];
            s[y] = t;
        }

        private static int eval(char[] s) {
            int base = 0, n = s.length;
            {
                int d = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(') d++;
                    else d--;
                    base = Math.min(base, d);
                }
            }

            int ans = 0;
            {
                int d = 0;
                for (int i = 0; i < n; i++) {
                    if (s[i] == '(') d++;
                    else d--;
                    if (s[i] == ')' && d - base == 0) ans++;
                }
            }
            return ans;
        }

    }

    static class LightWriter implements AutoCloseable {
        private final Writer out;
        private boolean autoflush = false;
        private boolean breaked = true;

        public LightWriter(Writer out) {
            this.out = out;
        }

        public LightWriter(OutputStream out) {
            this(new BufferedWriter(new OutputStreamWriter(out, Charset.defaultCharset())));
        }

        public LightWriter print(char c) {
            try {
                out.write(c);
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter print(String s) {
            try {
                out.write(s, 0, s.length());
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter ans(String s) {
            if (!breaked) {
                print(' ');
            }
            return print(s);
        }

        public LightWriter ans(int i) {
            return ans(Integer.toString(i));
        }

        public LightWriter ln() {
            print(System.lineSeparator());
            breaked = true;
            if (autoflush) {
                try {
                    out.flush();
                } catch (IOException ex) {
                    throw new UncheckedIOException(ex);
                }
            }
            return this;
        }

        public void close() {
            try {
                out.close();
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

    }
}

/*
 ID: tommatt1
 LANG: JAVA
 TASK:
*/
import java.util.*;
import java.io.*;
public class cf1239b{

	public static void main(String[] args)throws IOException {
		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		//BufferedReader bf=new BufferedReader(new FileReader("cf1239b.in"));
		//PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("cf1239b.out")));
		StringTokenizer st=new StringTokenizer(bf.readLine());
		int n=Integer.parseInt(st.nextToken());
		String s=bf.readLine();
		int[] a=new int[2*n+1];
		for(int i=0;i<n;i++) {
			if(s.charAt(i)=='(') {
				a[i+1]=1;
			}
			else {
				a[i+1]=-1;
			}
		}
		for(int i=n+1;i<2*n+1;i++) {
			a[i]=a[i-n];
		}
		int mn=0;
		int x=0;
		int zero=0;
		for(int i=1;i<=n;i++) {
			zero+=a[i];
			if(zero<mn) {
				mn=zero;
				x=i;
			}
		}
		if(zero!=0) {
			out.println(0);
			out.println(1+" "+1);
			out.close();
			return;
		}
		x++;
		int top=0;
		int ans=0;
		int[] stk=new int[n+1];
		int[] dep=new int[2*n+1];
		int[] psum=new int[2*n+1];
		int[] dsum=new int[2*n+1];
		int[] p=new int[2*n+1];
		for(int i=x;i<x+n;i++){
			if(a[i]==1) stk[++top]=i;
			else {
				psum[i]=dsum[top];
				dsum[top]=0;
				p[i]=stk[top--];
				dsum[top]++;
				dep[i]=top;
			}
			if(top==0) ans++;
		}
		int old=ans;
		int l=0;
		int r=0;
		for(int i=x+1;i<x+n;i++) {
			if(a[i]==-1) {
				if(dep[i]==0&&ans<psum[i]+1) {
					ans=psum[i]+1;
					l=p[i];
					r=i;
				}
				if(dep[i]==1&&ans<psum[i]+1+old) {
					ans=psum[i]+1+old;
					l=p[i];
					r=i;
				}
			}
		}
		out.println(ans);
		out.println(l%n+" "+r%n);
		out.close();
	}

}

/*
 ID: tommatt1
 LANG: JAVA
 TASK:
*/
import java.util.*;
import java.io.*;
public class cf1239b{

	public static void main(String[] args)throws IOException {
		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		//BufferedReader bf=new BufferedReader(new FileReader("cf1239b.in"));
		//PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("cf1239b.out")));
		StringTokenizer st=new StringTokenizer(bf.readLine());
		int n=Integer.parseInt(st.nextToken());
		String s=bf.readLine();
		int[] a=new int[2*n+1];
		for(int i=0;i<n;i++) {
			if(s.charAt(i)=='(') {
				a[i+1]=1;
			}
			else {
				a[i+1]=-1;
			}
		}
		for(int i=n+1;i<2*n+1;i++) {
			a[i]=a[i-n];
		}
		int mn=0;
		int x=0;
		int zero=0;
		for(int i=1;i<=n;i++) {
			zero+=a[i];
			if(zero<mn) {
				mn=zero;
				x=i;
			}
		}
		if(zero!=0) {
			out.println(0);
			out.println(1+" "+1);
			out.close();
			return;
		}
		x++;
		int top=0;
		int ans=0;
		int[] stk=new int[n+1];
		int[] dep=new int[2*n+1];
		int[] psum=new int[2*n+1];
		int[] dsum=new int[2*n+1];
		int[] p=new int[2*n+1];
		for(int i=x;i<x+n;i++){
			if(a[i]==1) stk[++top]=i;
			else {
				psum[i]=dsum[top];
				dsum[top]=0;
				p[i]=stk[top--];
				dsum[top]++;
				dep[i]=top;
			}
			if(top==0) ans++;
		}
		int old=ans;
		int l=0;
		int r=0;
		for(int i=x+1;i<x+n;i++) {
			if(a[i]==-1) {
				if(dep[i]==0&&ans<psum[i]+1) {
					ans=psum[i]+1;
					l=p[i];
					r=i;
				}
				if(dep[i]==1&&ans<psum[i]+1+old) {
					ans=psum[i]+1+old;
					l=p[i];
					r=i;
				}
			}
		}
		out.println(ans);
		out.print((l-1)%n+1+" ");
		out.println((r-1)%n+1);
		out.close();
	}

}

/*
 ID: tommatt1
 LANG: JAVA
 TASK:
*/
import java.util.*;
import java.io.*;
public class cf1239b{

	public static void main(String[] args)throws IOException {
		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		//BufferedReader bf=new BufferedReader(new FileReader("cf1239b.in"));
		//PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("cf1239b.out")));
		StringTokenizer st=new StringTokenizer(bf.readLine());
		int n=Integer.parseInt(st.nextToken());
		String s=bf.readLine();
		int[] a=new int[2*n+1];
		for(int i=0;i<n;i++) {
			if(s.charAt(i)=='(') {
				a[i+1]=1;
			}
			else {
				a[i+1]=-1;
			}
		}
		for(int i=n+1;i<2*n+1;i++) {
			a[i]=a[i-n];
		}
		int mn=0;
		int x=0;
		int zero=0;
		for(int i=1;i<=n;i++) {
			zero+=a[i];
			if(zero<mn) {
				mn=zero;
				x=i;
			}
		}
		if(zero!=0) {
			out.println(0);
			out.println(1+" "+1);
			out.close();
			return;
		}
		x++;
		int top=0;
		int ans=0;
		int[] stk=new int[n+1];
		int[] dep=new int[2*n+1];
		int[] psum=new int[2*n+1];
		int[] dsum=new int[2*n+1];
		int[] p=new int[2*n+1];
		for(int i=x;i<x+n;i++){
			if(a[i]==1) stk[++top]=i;
			else {
				psum[i]=dsum[top];
				dsum[top]=0;
				p[i]=stk[top--];
				dsum[top]++;
				dep[i]=top;
			}
			if(top==0) ans++;
		}
		int old=ans;
		int l=0;
		int r=0;
		for(int i=x+1;i<x+n;i++) {
			if(a[i]==-1) {
				if(dep[i]==0&&ans<psum[i]+1) {
					ans=psum[i]+1;
					l=p[i];
					r=i;
				}
				if(dep[i]==1&&ans<psum[i]+1+old) {
					ans=psum[i]+1+old;
					l=p[i];
					r=i;
				}
			}
		}
		out.println(ans);
		out.print((l-1)%n+1);
		out.print(" ");
		out.println((r-1)%n+1);
		out.close();
	}

}