#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  int finans, a, b;
  finans = 0;
  a = 1;
  b = 1;
  for (int ii = 0; ii < n; ii++)
    for (int j = 0; j < n; j++) {
      swap(str[ii], str[j]);
      int minele = 1000;
      vector<int> prefix(n + 1);
      for (int i = 0; i < n; i++) {
        if (str[i] == '(')
          prefix[i + 1] = prefix[i] + 1;
        else
          prefix[i + 1] = prefix[i] - 1;
        minele = min(minele, prefix[i + 1]);
      }
      swap(str[ii], str[j]);
      if (prefix[n] != 0) continue;
      int ans = 0;
      for (int i = 0; i < n; i++) {
        if (prefix[i + 1] == minele) ans++;
      }
      if (ans > finans) {
        finans = ans;
        a = ii + 1;
        b = j + 1;
      }
    }
  cout << finans << endl;
  cout << a << " " << b << endl;
  return 0;
}
