#include <bits/stdc++.h>
using namespace std;
string a;
int main() {
  int n;
  scanf("%d", &n);
  cin >> a;
  int ans = 0, l = 0, r = 0;
  for (int i = 0; i <= n - 1; i++) {
    for (int j = i + 1; j <= n - 1; j++) {
      swap(a[i], a[j]);
      int mi = 5000, cnt = 0, c = 0;
      for (int k = 0; k <= n - 1; k++) {
        if (a[k] == '(')
          cnt++;
        else
          cnt--;
        mi = min(mi, cnt);
      }
      if (!cnt) {
        for (int k = 0; k <= n - 1; k++) {
          if (a[k] == '(')
            cnt++;
          else
            cnt--;
          if (cnt == mi) c++;
        }
        if (ans < c) {
          ans = c;
          l = i;
          r = j;
        }
      }
      swap(a[i], a[j]);
    }
  }
  printf("%d\n%d %d\n", ans, ++l, ++r);
  return 0;
}
