x=int(input())
s=map(str,input().split())
c=0
for i in s:
n=0
for j in i:
if j==j.upper():
n+=1
c=max(n,c)
print(c)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define FastIO ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
const int N= 1e5+5,mod= 1e8+7;
int main(){
FastIO;
int t=1,cs=0; //cin>>t;
//cin.ignore();
while(t--){
string s;
ll n; cin>>n;
cin.ignore();
getline(cin,s);
ll cnt=0,ans=0;
//cout<<s<<endl;
for(ll i=0;i<s.size();i++){
if(s[i]==' '){
ans= max(ans,cnt);
cnt=0;
}
else if(s[i]>='A' && s[i]<='Z') cnt++;
}
ans= max(ans,cnt);
cout<<ans<<endl;
}
return 0;
}
/*
*/
838A - Binary Blocks | 1515D - Phoenix and Socks |
1624D - Palindromes Coloring | 1552F - Telepanting |
1692G - 2Sort | 1191A - Tokitsukaze and Enhancement |
903A - Hungry Student Problem | 52B - Right Triangles |
1712A - Wonderful Permutation | 1712D - Empty Graph |
1712B - Woeful Permutation | 1712C - Sort Zero |
1028B - Unnatural Conditions | 735B - Urbanization |
746C - Tram | 1278B - A and B |
1353D - Constructing the Array | 1269C - Long Beautiful Integer |
1076A - Minimizing the String | 913C - Party Lemonade |
1313A - Fast Food Restaurant | 681A - A Good Contest |
1585F - Non-equal Neighbours | 747A - Display Size |
285A - Slightly Decreasing Permutations | 515C - Drazil and Factorial |
1151E - Number of Components | 1151F - Sonya and Informatics |
556A - Case of the Zeros and Ones | 867A - Between the Offices |