#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
void debug_cerr() { cerr << '\n'; }
template <class Head, class... Tail>
void debug_cerr(Head head, Tail... tail) {
  cerr << ' ' << head;
  debug_cerr(tail...);
}
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;
template <class MeetSemiLattice>
struct SparseTable {
 private:
  vector<vector<MeetSemiLattice>> dat;
  vector<int> height;

 public:
  SparseTable() {}
  SparseTable(const vector<MeetSemiLattice>& vec) { init(vec); }
  void init(const vector<MeetSemiLattice>& vec) {
    int n = (int)vec.size(), h = 0;
    while ((1 << h) <= n) ++h;
    dat.assign(h, vector<MeetSemiLattice>(1 << h));
    height.assign(n + 1, 0);
    for (int i = 2; i <= n; i++) height[i] = height[i >> 1] + 1;
    for (int i = 0; i < n; ++i) dat[0][i] = vec[i];
    for (int i = 1; i < h; ++i) {
      for (int j = 0; j < n; ++j) {
        dat[i][j] = min<MeetSemiLattice>(
            dat[i - 1][j], dat[i - 1][min<int>(j + (1 << (i - 1)), n - 1)]);
      }
    }
  }
  inline MeetSemiLattice get(const int a, const int b) {
    int t = height[b - a];
    return min<MeetSemiLattice>(dat[t][a], dat[t][b - (1 << t)]);
  }
};
int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  vector<int> counter(N + 1, 0);
  for (int i = 0; i < (N); ++i) {
    char c = s[i];
    if (c == '(')
      counter[i + 1]++;
    else
      counter[i + 1]--;
    counter[i + 1] += counter[i];
  }
  if (counter[N] != 0) {
    cout << "0\n1 1\n";
    return 0;
  }
  vector<int> vec(N);
  for (int i = 0; i < (N); ++i) vec[i] = counter[i + 1];
  int mi = N;
  for (int i = 0; i < (N); ++i) chmin(mi, vec[i]);
  int most = 0;
  for (int i = 0; i < (N); ++i)
    if (vec[i] == mi) most++;
  pair<int, int> ans(0, 0);
  for (int j = 0; j < (N); ++j)
    for (int i = 0; i < (j); ++i) {
      if (s[i] == '(' && s[j] == ')') {
        int tmi = N;
        for (int k = 0; k < (i); ++k) chmin(tmi, vec[k]);
        for (int k = (i); k <= (j - 1); ++k) chmin(tmi, vec[k] - 2);
        for (int k = (j); k <= (N - 1); ++k) chmin(tmi, vec[k]);
        int tmp = 0;
        for (int k = 0; k < (i); ++k)
          if (vec[k] == tmi) tmp++;
        for (int k = (i); k <= (j - 1); ++k)
          if (vec[k] - 2 == tmi) tmp++;
        for (int k = (j); k <= (N - 1); ++k)
          if (vec[k] == tmi) tmp++;
        if (chmax(most, tmp)) ans = make_pair(i, j);
      }
      if (s[i] == ')' && s[j] == '(') {
        int tmi = N;
        for (int k = 0; k < (i); ++k) chmin(tmi, vec[k]);
        for (int k = (i); k <= (j - 1); ++k) chmin(tmi, vec[k] + 2);
        for (int k = (j); k <= (N - 1); ++k) chmin(tmi, vec[k]);
        int tmp = 0;
        for (int k = 0; k < (i); ++k)
          if (vec[k] == tmi) tmp++;
        for (int k = (i); k <= (j - 1); ++k)
          if (vec[k] + 2 == tmi) tmp++;
        for (int k = (j); k <= (N - 1); ++k)
          if (vec[k] == tmi) tmp++;
        if (chmax(most, tmp)) ans = make_pair(i, j);
      }
    }
  cout << most << '\n' << ans.first + 1 << ' ' << ans.second + 1 << '\n';
  return 0;
}
