#include <bits/stdc++.h>
using namespace std;
bool good(string &str) {
  map<char, long long> mp;
  for (long long i = 0; i < str.size(); i++) mp[str[i]]++;
  return (mp['('] == mp[')']);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, res = 0, l, r;
  string str;
  cin >> n >> str;
  if (!good(str)) {
    cout << "0\n1 1";
    return 0;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = i; j < n; j++) {
      swap(str[i], str[j]);
      long long mi = ((long long)(2e18)), cur = 0, co = 0;
      map<char, long long> mp;
      mp['('] = 1;
      mp[')'] = -1;
      for (long long t = 0; t < n; t++) {
        cur += mp[str[t]];
        if (cur == mi) co++;
        if (mi > cur) mi = cur, co = 1;
      }
      if (res < co) res = co, l = i + 1, r = j + 1;
      swap(str[i], str[j]);
    }
  }
  cout << res << "\n" << l << " " << r;
  return 0;
}
