@kuzinyd Yes you can count by using Regex Count.
assign str = "indra \n kumar \n country \n india"
assign int v1 = System.Text.RegularExpressions.Regex.Matches(str,"\\n").Count
Now v1 will have count 3
Hope this will helps you.Let me know for any other query.