#include <bits/stdc++.h>
int main(void) {
  long long n;
  scanf("%lld", &n);
  char st[n + 1];
  scanf("%s", st);
  std::vector<long long> brackets(n);
  for (long long i = 0; i < n; ++i) {
    if (st[i] == '(')
      brackets[i] = 1;
    else
      brackets[i] = -1;
  }
  long long sum = 0;
  for (long long i = 0; i < n; ++i) sum += brackets[i];
  if (sum) {
    puts("0\n1 1");
    return 0;
  }
  long long ans = 0;
  long long a = -1, b = -1;
  for (long long i = 0; i < n; ++i)
    for (long long j = i; j < n; ++j) {
      std::vector<long long> prefix_sum(n);
      std::vector<long long> br_cp(brackets);
      long long temp = br_cp[i];
      br_cp[i] = br_cp[j];
      br_cp[j] = temp;
      prefix_sum[0] = br_cp[0];
      long long mi = br_cp[0];
      for (long long k = 1; k < n; ++k) {
        prefix_sum[k] = prefix_sum[k - 1] + br_cp[k];
        mi = std::min(prefix_sum[k], mi);
      }
      long long cnt = 0;
      for (long long k = 0; k < n; ++k)
        if (prefix_sum[k] == mi) ++cnt;
      if (cnt > ans) {
        ans = cnt;
        a = i;
        b = j;
      }
    }
  printf("%lld\n", ans);
  printf("%lld %lld\n", a + 1, b + 1);
  return 0;
}
