#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long mx = 2e6 + 10;
int posx[] = {1, -1, 0, 0};
int posy[] = {0, 0, 1, -1};
int get(int i, int j, string x) {
  swap(x[i], x[j]);
  int mn = INT_MAX, cnt = 0, ans = 0;
  for (int i = 0; i < x.size(); i++) {
    if (x[i] == '(')
      cnt++;
    else
      cnt--;
    if (cnt == mn)
      ans++;
    else if (cnt < mn) {
      mn = cnt;
      ans = 1;
    }
  }
  if (cnt == 0)
    return ans;
  else
    return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1, n, k, m, a, b, c, d;
  while (t--) {
    string x;
    cin >> n >> x;
    int ans = -1, l, r;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        int cur = get(i, j, x);
        if (cur > ans) {
          ans = cur;
          l = i + 1;
          r = j + 1;
        }
      }
    }
    cout << ans << '\n';
    cout << min(l, r) << " " << max(l, r) << '\n';
  }
  return 0;
}
