#include <bits/stdc++.h>
using namespace std;
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, set<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class T>
ostream& operator<<(ostream& os, multiset<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class L, class R>
ostream& operator<<(ostream& os, map<L, R> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.F << ":" << m.S << ") ";
  return os << "}";
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " |";
  __f(comma + 1, args...);
}
string str;
int n;
int get() {
  int cl = 0, cnt = 0, lc = 0;
  for (char c : str) {
    if (c == ')')
      cl++;
    else
      cl--;
    if (cl > lc) {
      lc = cl;
      cnt = 0;
    } else if (cl == lc) {
      cnt++;
    }
  }
  return cnt + (lc != 0);
}
void solve() {
  cin >> n >> str;
  if (n % 2 or count(str.begin(), str.end(), ')') != n / 2) {
    cout << "0\n1 1\n";
    return;
  }
  int ans = get(), gi = 1, gj = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (str[i] == str[j]) continue;
      swap(str[i], str[j]);
      int ta = get();
      if (ta > ans) {
        ans = ta;
        gi = i + 1;
        gj = j + 1;
      }
      swap(str[i], str[j]);
    }
  }
  cout << ans << '\n' << gi << " " << gj << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1, tc = 1;
  while (T--) {
    solve();
  }
  return 0;
}
