#include <bits/stdc++.h>
using namespace std;
const int N = 500;
int n;
char s[N + 1];
int get() {
  int b = 0;
  int mn = ~(1 << 31), amt = 1;
  for (int i = 0; i < n; ++i) {
    b += (-2 * (s[i] == ')')) + 1;
    if (b < mn) {
      mn = b;
      amt = 1;
    } else if (b == mn)
      ++amt;
  }
  if (b) return 0;
  return amt;
}
int main() {
  int ans = 0;
  pair<int, int> sw(1, 1);
  scanf("%d%s", &n, s);
  for (int i = 0; i < n; ++i)
    for (int j = i; j < n; ++j)
      if (s[i] != s[j] || i == j) {
        swap(s[i], s[j]);
        int t = get();
        if (ans < t) {
          ans = t;
          sw.first = i + 1;
          sw.second = j + 1;
        }
        swap(s[i], s[j]);
      }
  printf("%d\n%d %d\n", ans, sw.first, sw.second);
  return 0;
}
