using System;
using System.Collections.Generic;
using System.Linq;
public class Program {
    public static void Main() {
        string[] inputs = Console.ReadLine().Split(' ');
        int n = int.Parse(inputs[0]);
        int m = int.Parse(inputs[1]);
        int k = int.Parse(inputs[2]);

        char[,] matrix = new char[n, m];
        for(int i = 0; i < n; i++)
        {
            string row = Console.ReadLine();
            for(int j = 0; j < m; j++)
            {
                matrix[i, j] = row[j];
            }
        }

        // 存储所有连续白色段的长度
        List<int> whiteSegments = new List<int>();

        // 遍历每一列
        for(int j = 0; j < m; j++)
        {
            int count = 0;
            for(int i = 0; i < n; i++)
            {
                if(matrix[i, j] == 'o') // 白色格子
                {
                    count++;
                }
                else // matrix[i, j] == '*'(黑色障碍)
                {
                    if(count > 0)
                    {
                        whiteSegments.Add(count);
                        count = 0;
                    }
                }
            }
            if(count > 0)
            {
                whiteSegments.Add(count);
            }
        }

        // 按段长度降序排序(长段优先)
        whiteSegments.Sort((a, b) => b.CompareTo(a));

        int totalScore = 0;
        int remainingEnergy = k;

        foreach(int segmentLength in whiteSegments)
        {
            if(remainingEnergy <= 0) break;
            
            // 在这个段中,最多能染 min(segmentLength, remainingEnergy) 个格子
            int dyeCount = Math.Min(segmentLength, remainingEnergy);
            // 得分 = 染的数量 - 1(如果是连续染的)
            int score = Math.Max(0, dyeCount - 1);
            
            totalScore += score;
            remainingEnergy -= dyeCount;
        }

        Console.WriteLine(totalScore);
    }
}