#include <bits/stdc++.h>
using namespace std;
const long long int N = 100005;
string s;
long long int give() {
  long long int ans = 1e9, cnt = 0, i, n = s.size(), res = 0;
  for (i = 0; i < n; i++) {
    cnt += (s[i] == '(');
    cnt -= (s[i] == ')');
    ans = min(ans, cnt);
  }
  if (cnt != 0) return 0;
  for (i = 0; i < n; i++) {
    cnt += (s[i] == '(');
    cnt -= (s[i] == ')');
    if (cnt == ans) res++;
  }
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  {
    long long int i, j, k, n, m, ans = 0, cnt = 0, sum = 0;
    cin >> n;
    cin >> s;
    long long int pos1 = 0, pos2 = 0;
    for (i = 0; i < n; i++) {
      for (j = i; j < n; j++) {
        swap(s[i], s[j]);
        if (j > i && s[i] == s[j]) continue;
        cnt = give();
        if (cnt > ans) {
          pos1 = i, pos2 = j;
          ans = cnt;
        }
        swap(s[i], s[j]);
      }
    }
    cout << ans << '\n';
    cout << pos1 + 1 << " " << pos2 + 1;
  }
}
