import java.util.*; import java.io.*; public class Main { static IO io = new IO(); public static void main(String[] args) { int n = io.nextInt(); int ans[] = new int[n]; char c[] = io.nextCharArray(n); Deque que = new ArrayDeque(); for (int i = 0; i < n; i++) { if (c[i]=='(') que.offer(i); else { int t = que.pollLast(); ans[t] = i; ans[i] = t; } } for (int i=0; i Integer.MAX_VALUE) { throw new NumberFormatException(); } return (int) nl; } char nextChar() { if (!hasNext()) { throw new NoSuchElementException(); } return (char) readByte(); } double nextDouble() { return Double.parseDouble(next()); } int[] arrayInt(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } long[] arrayLong(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = nextLong(); return a; } double[] arrayDouble(int n) { double[] a = new double[n]; for (int i = 0; i < n; i++) a[i] = nextDouble(); return a; } void arrayInt(int[]... a) { for (int i = 0; i < a[0].length; i++) for (int j = 0; j < a.length; j++) a[j][i] = nextInt(); } int[][] matrixInt(int n, int m) { int[][] a = new int[n][]; for (int i = 0; i < n; i++) a[i] = arrayInt(m); return a; } char[][] charMap(int n, int m) { char[][] a = new char[n][]; for (int i = 0; i < n; i++) a[i] = nextCharArray(m); return a; } public void close() { super.close(); try { in.close(); } catch (IOException e) { } } } }