#include <cstddef>
#include <iostream>
#include <ostream>
#include <string>
#include <vector>
int main () {
// Input:
// n rooms
// Building layout
// e.g.
// 20
// **.*......*.R*...*..
// * = coin; . = empty; R = robot
int Rooms;
std::string Layout;
std::cin >> Rooms >> Layout;
// GOAL: Find the max number of coins the robot can collect by always going to
// the closest coin
std::vector<int> Output = {0,0};
std::vector<int> CollectCoins(int Rooms, std::string Layout, std::vector<int> Output) {
std::size_t CurRobot = Layout.find("R");
// Distance to the first coin left
std::size_t CoinLeft = Layout.find_last_of("*", CurRobot);
std::size_t DistanceLeft = CurRobot - CoinLeft;
// Distance to the first coin right
std::size_t CoinRight = Layout.find_first_of("*", CurRobot);
std::size_t DistanceRight = CoinRight - CurRobot;
if (DistanceLeft==DistanceRight || ((CoinLeft == (size_t)-1) && (CoinRight == (size_t)-1))) {
return Output;
}
Layout[CurRobot] = '.';
Output[1]++;
if (DistanceLeft<DistanceRight) {
Output[0] += DistanceLeft;
Layout[CoinLeft] = 'R';
} else {
Output[0] += DistanceRight;
Layout[CoinRight] = 'R';
}
//std::cout << Layout << "\n";
return CollectCoins(Rooms, Layout, Output);
}
Output = CollectCoins(Rooms, Layout, Output);
int Steps = Output[0];
int Coins = Output[1];
std::cout << Steps << " " << Coins << "\n";
}