#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
const int Max = 10055;
int gcd( long long a , long long b )
{
    if ( b == 0 )
    return a ;
    else
        return  gcd ( b , a % b ) ;
}
 long long lcm ( long long  a , long long b )
{
    return ( a* ( b / gcd ( a , b ) ) ) ;
}
int main()
{
     int n  , sum = 0 , k = 0 ;
     cin >> n ;
     int a[n] , b[n] ;
     for ( int i = 0 ; i < n ; i++ )
             cin >> a[i] ;
     sort ( a , a + n ) ;
     for ( int i = 0 , j = n - 1 ; i < n / 2 ; i++ , j --  )
         if ( a[i] != a[j])
         sum++ ;
     if ( n % 2 != 0 )
     {
         n-- ;
         if ( a[n/2] != a[n/2-1] )
            sum++ ;
         if ( a[n/2+1] != a[n/2] )
            sum++ ;
     }
     cout << sum ;
    /*
───────────▄▄▄▄▄▄▄▄▄▄▄▄▄
────────▄▀▀─────────────▀▀▄
───────█───────────────────█
──────█─────────────────────█
─────█───▄▄▄▄▄▄▄───▄▄▄▄▄▄▄───█
────█───█████████─█████████───█
────█──██▀────▀█████▀────▀██──█
───██████───█▀█─███───█▀█─██████
───██████───▀▀▀─███───▀▀▀─██████
────█──▀█▄────▄██─██▄────▄█▀──█
────█────▀█████▀───▀█████▀────█
────█───────────────▄▄▄───────█
────█───────▄▄▄▄██▀▀█▀▀█▄─────█
────█─────▄██▄█▄▄█▄▄█▄▄██▄────█
────█─────▀▀█████████████▀────█
───▐▓▓▌─────────────────────▐▓▓▌
───▐▐▓▓▌▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▐▓▓▌▌
───█══▐▓▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄▓▌══█
──█══▌═▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌═▐══█
──█══█═▐▓▓▓▓▓▓▄▄▄▄▄▄▄▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▐██▀██▌▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▓▀▀▀▀▀▓▓▓▓▓▓▓▌═█══█

──█───█─█──█─█▀▀█─▀▀█▀▀─▀█─█─▀█──
──█▄█▄█─█▀▀█─█▄▄█───█───█▀─▀─█▀──
───▀─▀──▀──▀─▀──▀───▀───▄──▄─▄───
       Brace yourself Mesoo is coming ^_^

*/
}


#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
const int Max = 10055;
int gcd( long long a , long long b )
{
    if ( b == 0 )
    return a ;
    else
        return  gcd ( b , a % b ) ;
}
 long long lcm ( long long  a , long long b )
{
    return ( a* ( b / gcd ( a , b ) ) ) ;
}
int main()
{
     int n  , sum = 0 , k = 0 ;
     cin >> n ;
     int a[n] , b[n] ;
     for ( int i = 0 ; i < n ; i++ )
             cin >> a[i] ;
     sort ( a , a + n ) ;
     for ( int i = 0 ; i < n - 1 ; i++ )
     {
         if ( a[i] == a[i+1])
         {
             b[k] = a[i] ;
             k++ ;
         }
         else
            sum++ ;
     }
     for ( int i = 0 , j = k - 1 ; i < k/2 ; i++ , j-- )
     {
         if ( b[i] != b[j])
            sum++ ;
     }
     if ( ( k % 2 != 0 && b[k/2+1] != b[k/2] && k != 0 && k > 2 ))
        sum++ ;
    if (  ( k % 2 != 0 && b[k/2+1] != b[k/2+2] && k > 2 ))
        sum++ ;
     cout << sum ;
    /*
───────────▄▄▄▄▄▄▄▄▄▄▄▄▄
────────▄▀▀─────────────▀▀▄
───────█───────────────────█
──────█─────────────────────█
─────█───▄▄▄▄▄▄▄───▄▄▄▄▄▄▄───█
────█───█████████─█████████───█
────█──██▀────▀█████▀────▀██──█
───██████───█▀█─███───█▀█─██████
───██████───▀▀▀─███───▀▀▀─██████
────█──▀█▄────▄██─██▄────▄█▀──█
────█────▀█████▀───▀█████▀────█
────█───────────────▄▄▄───────█
────█───────▄▄▄▄██▀▀█▀▀█▄─────█
────█─────▄██▄█▄▄█▄▄█▄▄██▄────█
────█─────▀▀█████████████▀────█
───▐▓▓▌─────────────────────▐▓▓▌
───▐▐▓▓▌▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▐▓▓▌▌
───█══▐▓▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄▓▌══█
──█══▌═▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌═▐══█
──█══█═▐▓▓▓▓▓▓▄▄▄▄▄▄▄▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▐██▀██▌▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▓▀▀▀▀▀▓▓▓▓▓▓▓▌═█══█

──█───█─█──█─█▀▀█─▀▀█▀▀─▀█─█─▀█──
──█▄█▄█─█▀▀█─█▄▄█───█───█▀─▀─█▀──
───▀─▀──▀──▀─▀──▀───▀───▄──▄─▄───
       Brace yourself Mesoo is coming ^_^

*/
}


#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
const int Max = 10055;
int gcd( long long a , long long b )
{
    if ( b == 0 )
    return a ;
    else
        return  gcd ( b , a % b ) ;
}
 long long lcm ( long long  a , long long b )
{
    return ( a* ( b / gcd ( a , b ) ) ) ;
}
int main()
{
     int n  , sum = 0 , k = 0 ;
     cin >> n ;
     int a[n] , b[n] ;
     for ( int i = 0 ; i < n ; i++ )
             cin >> a[i] ;
     sort ( a , a + n ) ;
     for ( int i = 0 ; i < n - 1 ; i++ )
     {
         if ( a[i] == a[i+1])
         {
             b[k] = a[i] ;
             k++ ;
         }
         else
            sum++ ;
     }
     for ( int i = 0 , j = k - 1 ; i < k/2 ; i++ , j-- )
     {
         if ( b[i] != b[j])
            sum++ ;
     }
     if ( k % 2 != 0 )
        sum++ ;
     cout << sum ;
    /*
───────────▄▄▄▄▄▄▄▄▄▄▄▄▄
────────▄▀▀─────────────▀▀▄
───────█───────────────────█
──────█─────────────────────█
─────█───▄▄▄▄▄▄▄───▄▄▄▄▄▄▄───█
────█───█████████─█████████───█
────█──██▀────▀█████▀────▀██──█
───██████───█▀█─███───█▀█─██████
───██████───▀▀▀─███───▀▀▀─██████
────█──▀█▄────▄██─██▄────▄█▀──█
────█────▀█████▀───▀█████▀────█
────█───────────────▄▄▄───────█
────█───────▄▄▄▄██▀▀█▀▀█▄─────█
────█─────▄██▄█▄▄█▄▄█▄▄██▄────█
────█─────▀▀█████████████▀────█
───▐▓▓▌─────────────────────▐▓▓▌
───▐▐▓▓▌▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▐▓▓▌▌
───█══▐▓▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄▓▌══█
──█══▌═▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌═▐══█
──█══█═▐▓▓▓▓▓▓▄▄▄▄▄▄▄▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▐██▀██▌▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▓▀▀▀▀▀▓▓▓▓▓▓▓▌═█══█

──█───█─█──█─█▀▀█─▀▀█▀▀─▀█─█─▀█──
──█▄█▄█─█▀▀█─█▄▄█───█───█▀─▀─█▀──
───▀─▀──▀──▀─▀──▀───▀───▄──▄─▄───
       Brace yourself Mesoo is coming ^_^

*/
}


#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
const int Max = 10055;
int gcd( long long a , long long b )
{
    if ( b == 0 )
    return a ;
    else
        return  gcd ( b , a % b ) ;
}
 long long lcm ( long long  a , long long b )
{
    return ( a* ( b / gcd ( a , b ) ) ) ;
}
int main()
{
     int n  , sum = 0 , k = 0 ;
     cin >> n ;
     int a[n] , b[n] ;
     for ( int i = 0 ; i < n ; i++ )
             cin >> a[i] ;
     sort ( a , a + n ) ;
     for ( int i = 0 ; i < n - 1 ; i++ )
     {
         if ( a[i] == a[i+1])
         {
             b[k] = a[i] ;
             k++ ;
         }
         else
            sum++ ;
     }
     for ( int i = 0 , j = k - 1 ; i < k/2 ; i++ , j-- )
     {
         if ( b[i] != b[j])
            sum++ ;
     }
     if ( ( k % 2 != 0 && b[k/2+1] != b[k/2] && k != 0 && k > 2 ) || ( k % 2 != 0 && b[k/2+1] != b[k/2+2] && k > 2 ))
        sum++ ;
     cout << sum ;
    /*
───────────▄▄▄▄▄▄▄▄▄▄▄▄▄
────────▄▀▀─────────────▀▀▄
───────█───────────────────█
──────█─────────────────────█
─────█───▄▄▄▄▄▄▄───▄▄▄▄▄▄▄───█
────█───█████████─█████████───█
────█──██▀────▀█████▀────▀██──█
───██████───█▀█─███───█▀█─██████
───██████───▀▀▀─███───▀▀▀─██████
────█──▀█▄────▄██─██▄────▄█▀──█
────█────▀█████▀───▀█████▀────█
────█───────────────▄▄▄───────█
────█───────▄▄▄▄██▀▀█▀▀█▄─────█
────█─────▄██▄█▄▄█▄▄█▄▄██▄────█
────█─────▀▀█████████████▀────█
───▐▓▓▌─────────────────────▐▓▓▌
───▐▐▓▓▌▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▐▓▓▌▌
───█══▐▓▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄▓▌══█
──█══▌═▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌═▐══█
──█══█═▐▓▓▓▓▓▓▄▄▄▄▄▄▄▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▐██▀██▌▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▓▀▀▀▀▀▓▓▓▓▓▓▓▌═█══█

──█───█─█──█─█▀▀█─▀▀█▀▀─▀█─█─▀█──
──█▄█▄█─█▀▀█─█▄▄█───█───█▀─▀─█▀──
───▀─▀──▀──▀─▀──▀───▀───▄──▄─▄───
       Brace yourself Mesoo is coming ^_^

*/
}


#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
const double PI = acos(-1.0);
using namespace std ;
const int Max = 10055;
int gcd( long long a , long long b )
{
    if ( b == 0 )
    return a ;
    else
        return  gcd ( b , a % b ) ;
}
 long long lcm ( long long  a , long long b )
{
    return ( a* ( b / gcd ( a , b ) ) ) ;
}
bool com ( string x , string y )
{
    return x + y < y + x ;
}
//bool comp ( pair < pair < int , int > , string > i , pair < pair < int , int > ,string > j )
//{
//    if ( i.first.first == j.first.first && ( i.first.second >= j.first.second ) )
//        return i.first.first > j.first.first ;
//    else
//        if ( i.first.first == j.first.first && ( i.first.second < j.first.second) )
//        return i.first.first < j.first.first ;
//    else if ( i.first.first < j.first.first)
//        return i.first.first > j.first.first ;
//    else if (i.first.first > j.first.first )
//       return i.first.first < j.first.first ;
//}
//bool prime[1000005] ;
//void testprime( )
//{
//
//    for (int p = 1 ; p <= 1000000 ; p++ )
//        prime[p] = true ;
//    for (int p = 2 ; p * p <= 1000000 ; p++ )
//    {
//        if ( prime[p] == true)
//        {
//            for (int i = p * 2 ; i <= 1000000 ; i += p )
//                prime[i] = false ;
//        }
//    }
////    for ( int p = 2 ; p <= 1000000 ; p++ )
////       if ( prime[p] )
////          cout << p << " ";
//}
int main()
{
      int n , mx = -1 ;
      cin >> n ;
      int a[n] ;
      for ( int i = 0 ; i < n ; i++ )
        cin >> a[i] ;
        if ( n == 1 )
            return cout << "0" , 0 ;
      sort ( a , a + n ) ;
      for ( int i = 0 ; i < n - 1 ; i++ )
      {
          int sum = 0 ;
          for ( int j = i + 1 ; j < n ; j++ )
            if ( a[i] < a[j] )
            sum++ ;
          mx = max ( mx , sum ) ;
      }
     cout << mx ;
     return 0 ;
    /**
       Brace yourself Mesoo is coming :P
    **/
}


#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
const int Max = 10055;
int gcd( long long a , long long b )
{
    if ( b == 0 )
    return a ;
    else
        return  gcd ( b , a % b ) ;
}
 long long lcm ( long long  a , long long b )
{
    return ( a* ( b / gcd ( a , b ) ) ) ;
}
int main()
{
     int n  , sum = 0 , k = 0 ;
     cin >> n ;
     int a[n] , b[n] ;
     for ( int i = 0 ; i < n ; i++ )
             cin >> a[i] ;
     sort ( a , a + n ) ;
     for ( int i = 0 ; i < n - 1 ; i++ )
     {
         if ( a[i] == a[i+1])
         {
             b[k] = a[i] ;
             k++ ;
         }
         else
            sum++ ;
     }
     for ( int i = 0 ; i < k - 1 ; i++ )
     {
         if ( b[i] != b[i+1])
            sum++ ;
     }
     cout << sum ;
    /*
───────────▄▄▄▄▄▄▄▄▄▄▄▄▄
────────▄▀▀─────────────▀▀▄
───────█───────────────────█
──────█─────────────────────█
─────█───▄▄▄▄▄▄▄───▄▄▄▄▄▄▄───█
────█───█████████─█████████───█
────█──██▀────▀█████▀────▀██──█
───██████───█▀█─███───█▀█─██████
───██████───▀▀▀─███───▀▀▀─██████
────█──▀█▄────▄██─██▄────▄█▀──█
────█────▀█████▀───▀█████▀────█
────█───────────────▄▄▄───────█
────█───────▄▄▄▄██▀▀█▀▀█▄─────█
────█─────▄██▄█▄▄█▄▄█▄▄██▄────█
────█─────▀▀█████████████▀────█
───▐▓▓▌─────────────────────▐▓▓▌
───▐▐▓▓▌▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▐▓▓▌▌
───█══▐▓▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄▓▌══█
──█══▌═▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌═▐══█
──█══█═▐▓▓▓▓▓▓▄▄▄▄▄▄▄▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▐██▀██▌▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▓▀▀▀▀▀▓▓▓▓▓▓▓▌═█══█

──█───█─█──█─█▀▀█─▀▀█▀▀─▀█─█─▀█──
──█▄█▄█─█▀▀█─█▄▄█───█───█▀─▀─█▀──
───▀─▀──▀──▀─▀──▀───▀───▄──▄─▄───
       Brace yourself Mesoo is coming ^_^

*/
}


#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
const double PI = acos(-1.0);
using namespace std ;
const int Max = 10055;
int gcd( long long a , long long b )
{
    if ( b == 0 )
    return a ;
    else
        return  gcd ( b , a % b ) ;
}
 long long lcm ( long long  a , long long b )
{
    return ( a* ( b / gcd ( a , b ) ) ) ;
}
bool com ( string x , string y )
{
    return x + y < y + x ;
}
//bool comp ( pair < pair < int , int > , string > i , pair < pair < int , int > ,string > j )
//{
//    if ( i.first.first == j.first.first && ( i.first.second >= j.first.second ) )
//        return i.first.first > j.first.first ;
//    else
//        if ( i.first.first == j.first.first && ( i.first.second < j.first.second) )
//        return i.first.first < j.first.first ;
//    else if ( i.first.first < j.first.first)
//        return i.first.first > j.first.first ;
//    else if (i.first.first > j.first.first )
//       return i.first.first < j.first.first ;
//}
//bool prime[1000005] ;
//void testprime( )
//{
//
//    for (int p = 1 ; p <= 1000000 ; p++ )
//        prime[p] = true ;
//    for (int p = 2 ; p * p <= 1000000 ; p++ )
//    {
//        if ( prime[p] == true)
//        {
//            for (int i = p * 2 ; i <= 1000000 ; i += p )
//                prime[i] = false ;
//        }
//    }
////    for ( int p = 2 ; p <= 1000000 ; p++ )
////       if ( prime[p] )
////          cout << p << " ";
//}
int main()
{
     int a[1001] = {0} , sum = 0 ;
     int n ;
     cin >> n ;
     for ( int i = 0 ; i < n ; i++ )
     {
         int x ;
         cin >> x ;
         a[x]++ ;
     }
     for ( int i = 0 ; i < 1000 ; i++ )
     {
         while ( a[i]--)
            for ( int j = i + 1 ; j < 1001 ; j++ )
               if ( a [j] )
         {
             sum++ ;
             a[j]-- ;
         }
     }
     cout << sum ;
     return 0 ;
    /**
       Brace yourself Mesoo is coming :P
    **/
}


#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
const int Max = 10055;
int gcd( long long a , long long b )
{
    if ( b == 0 )
    return a ;
    else
        return  gcd ( b , a % b ) ;
}
 long long lcm ( long long  a , long long b )
{
    return ( a* ( b / gcd ( a , b ) ) ) ;
}
int main()
{
     int n  , sum = 0 ;
     cin >> n ;
     set < int > a ;
     for ( int i = 0 ; i < n ; i++ )
         {
             int x ;
             cin >> x ;
             a.insert (x) ;
         }
         if ( a.size() == n )
            cout << n - 1 ;
         else
            cout << a.size() ;

    /*
───────────▄▄▄▄▄▄▄▄▄▄▄▄▄
────────▄▀▀─────────────▀▀▄
───────█───────────────────█
──────█─────────────────────█
─────█───▄▄▄▄▄▄▄───▄▄▄▄▄▄▄───█
────█───█████████─█████████───█
────█──██▀────▀█████▀────▀██──█
───██████───█▀█─███───█▀█─██████
───██████───▀▀▀─███───▀▀▀─██████
────█──▀█▄────▄██─██▄────▄█▀──█
────█────▀█████▀───▀█████▀────█
────█───────────────▄▄▄───────█
────█───────▄▄▄▄██▀▀█▀▀█▄─────█
────█─────▄██▄█▄▄█▄▄█▄▄██▄────█
────█─────▀▀█████████████▀────█
───▐▓▓▌─────────────────────▐▓▓▌
───▐▐▓▓▌▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▐▓▓▌▌
───█══▐▓▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄▓▌══█
──█══▌═▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌═▐══█
──█══█═▐▓▓▓▓▓▓▄▄▄▄▄▄▄▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▐██▀██▌▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▓▀▀▀▀▀▓▓▓▓▓▓▓▌═█══█

──█───█─█──█─█▀▀█─▀▀█▀▀─▀█─█─▀█──
──█▄█▄█─█▀▀█─█▄▄█───█───█▀─▀─█▀──
───▀─▀──▀──▀─▀──▀───▀───▄──▄─▄───
       Brace yourself Mesoo is coming ^_^

*/
}


#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
const int Max = 10055;
int gcd( long long a , long long b )
{
    if ( b == 0 )
    return a ;
    else
        return  gcd ( b , a % b ) ;
}
 long long lcm ( long long  a , long long b )
{
    return ( a* ( b / gcd ( a , b ) ) ) ;
}
int main()
{
     int n  , sum = 0 , k = 0 ;
     cin >> n ;
     int a[n] , b[n] ;
     for ( int i = 0 ; i < n ; i++ )
             cin >> a[i] ;
     sort ( a , a + n ) ;
     for ( int i = 0 ; i < n - 1 ; i++ )
     {
         if ( a[i] == a[i+1])
         {
             b[k] = a[i] ;
             k++ ;
         }
         else
            sum++ ;
     }
     for ( int i = 0 , j = k - 1 ; i < k/2 ; i++ , j-- )
     {
         if ( b[i] != b[j])
            sum++ ;
     }
     k -- ;
     if ( ( k % 2 != 0 && b[k/2+1] != b[k/2] && k != 0 && k > 2 ) || ( k % 2 != 0 && b[k/2+1] != b[k/2+2] && k > 2 ))
        sum++ ;
     cout << sum ;
    /*
───────────▄▄▄▄▄▄▄▄▄▄▄▄▄
────────▄▀▀─────────────▀▀▄
───────█───────────────────█
──────█─────────────────────█
─────█───▄▄▄▄▄▄▄───▄▄▄▄▄▄▄───█
────█───█████████─█████████───█
────█──██▀────▀█████▀────▀██──█
───██████───█▀█─███───█▀█─██████
───██████───▀▀▀─███───▀▀▀─██████
────█──▀█▄────▄██─██▄────▄█▀──█
────█────▀█████▀───▀█████▀────█
────█───────────────▄▄▄───────█
────█───────▄▄▄▄██▀▀█▀▀█▄─────█
────█─────▄██▄█▄▄█▄▄█▄▄██▄────█
────█─────▀▀█████████████▀────█
───▐▓▓▌─────────────────────▐▓▓▌
───▐▐▓▓▌▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▐▓▓▌▌
───█══▐▓▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄▓▌══█
──█══▌═▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌═▐══█
──█══█═▐▓▓▓▓▓▓▄▄▄▄▄▄▄▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▐██▀██▌▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▓▀▀▀▀▀▓▓▓▓▓▓▓▌═█══█

──█───█─█──█─█▀▀█─▀▀█▀▀─▀█─█─▀█──
──█▄█▄█─█▀▀█─█▄▄█───█───█▀─▀─█▀──
───▀─▀──▀──▀─▀──▀───▀───▄──▄─▄───
       Brace yourself Mesoo is coming ^_^

*/
}


#include <iostream>
#include <string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
const int Max = 10055;
int gcd( long long a , long long b )
{
    if ( b == 0 )
    return a ;
    else
        return  gcd ( b , a % b ) ;
}
 long long lcm ( long long  a , long long b )
{
    return ( a* ( b / gcd ( a , b ) ) ) ;
}
int main()
{
     int n  , sum = 0 , k = 0 ;
     cin >> n ;
     int a[n] , b[n] ;
     for ( int i = 0 ; i < n ; i++ )
             cin >> a[i] ;
     sort ( a , a + n ) ;
     for ( int i = 0 ; i < n - 1 ; i++ )
     {
         if ( a[i] == a[i+1])
         {
             b[k] = a[i] ;
             k++ ;
         }
         else
            sum++ ;
     }
     for ( int i = 0 ; i < k - 1 ; i++ )
     {
         if ( b[k] != b[k+1])
            sum++ ;
     }
     cout << sum ;
    /*
───────────▄▄▄▄▄▄▄▄▄▄▄▄▄
────────▄▀▀─────────────▀▀▄
───────█───────────────────█
──────█─────────────────────█
─────█───▄▄▄▄▄▄▄───▄▄▄▄▄▄▄───█
────█───█████████─█████████───█
────█──██▀────▀█████▀────▀██──█
───██████───█▀█─███───█▀█─██████
───██████───▀▀▀─███───▀▀▀─██████
────█──▀█▄────▄██─██▄────▄█▀──█
────█────▀█████▀───▀█████▀────█
────█───────────────▄▄▄───────█
────█───────▄▄▄▄██▀▀█▀▀█▄─────█
────█─────▄██▄█▄▄█▄▄█▄▄██▄────█
────█─────▀▀█████████████▀────█
───▐▓▓▌─────────────────────▐▓▓▌
───▐▐▓▓▌▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▐▓▓▌▌
───█══▐▓▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄▓▌══█
──█══▌═▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌═▐══█
──█══█═▐▓▓▓▓▓▓▄▄▄▄▄▄▄▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▐██▀██▌▓▓▓▓▓▓▌═█══█
──█══█═▐▓▓▓▓▓▓▓▀▀▀▀▀▓▓▓▓▓▓▓▌═█══█

──█───█─█──█─█▀▀█─▀▀█▀▀─▀█─█─▀█──
──█▄█▄█─█▀▀█─█▄▄█───█───█▀─▀─█▀──
───▀─▀──▀──▀─▀──▀───▀───▄──▄─▄───
       Brace yourself Mesoo is coming ^_^

*/
}


#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1005;
int a[MAXN], ordered[MAXN];
bool catched[MAXN];

int main(){
    int n; scanf("%d", &n);

    //formats the arrays
    for(int i = 0; i < MAXN; i++){
        a[i] = 0;
        ordered[i] = 0;
        catched[i] = false;
    }

    //populates 'a' array with the inputs
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);

    //sorts the 'a' array
    sort(a, a+n);

    //sets the faulting variable to the number of inputs and an 'j' variable to 0
    int faulting = n, j = 0;

    //while there are elements which weren't counted yet
    while(faulting > 0){

        //takes every element different from its precedent
        for(int i = 0; i < n; i++){
            if(i == 0 || a[i] != a[i-1]){
                ordered[j++] = a[i];
                catched[i] = true;
                faulting--;
            }
        }

        bool allEqual = true;

        if(faulting > 0){
            //populates the 'a' array with the remaining
            int k = 0;
            for(int i = 0; i < n; i++){
                if(catched[i] == false) a[k++] = a[i];
            }

            //formats the array after what matters
            for(int i = k; i < MAXN; i++) a[i] = 0;

            //formats the catched array
            for(int i = 0; i < MAXN; i++) catched[i] = false;

            //verifies if there are different elements in the array
            for(int i = 1; i < n; i++){
                if(a[i-1] == 0) break;
                if(a[i] != 0 && a[i] != a[i-1]) allEqual = false;
            } if(allEqual) break;
        }
    }
    int counter  = 0;
    for(int i = 0; i < n; i++){
        if(ordered[i] < ordered[i+1]) counter++;
    }

    printf("%d", counter);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1005;
int a[MAXN], ordered[MAXN];
bool catched[MAXN];

int main(){
    int n; scanf("%d", &n);

    //formats the arrays
    for(int i = 0; i < MAXN; i++){
        a[i] = 0;
        ordered[i] = 0;
        catched[i] = false;
    }

    //populates 'a' array with the inputs
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);

    //sorts the 'a' array
    sort(a, a+n);

    //sets the faulting variable to the number of inputs and a 'j' variable to 0
    int faulting = n, j = 0;

    //while there are elements which weren't counted yet
    while(faulting > 0){
        //takes every element different from its precedent
        for(int i = 0; i < n; i++){
            if(i == 0 || a[i] != a[i-1]){
                ordered[j++] = a[i];
                catched[i] = true;
                faulting--;
            }
        }

        bool allEqual = true;

        //if there are still elements which weren't catched
        if(faulting > 0){
            //populates the 'a' array with the remaining
            int k = 0;
            for(int i = 0; i < n; i++){
                if(catched[i] == false){
                    a[k++] = a[i];
                }
            }

            //formats the array after what matters
            for(int i = k; i < MAXN; i++) a[i] = 0;

            //formats the catched array
            for(int i = 0; i < MAXN; i++) catched[i] = false;

            //verifies if there are different elements in the array
            for(int i = 1; i < n; i++){
                if(a[i-1] == 0) break;
                if(a[i] != 0 && a[i] != a[i-1]) allEqual = false;
            } if(allEqual) break;
        }

        // debug for(int i = 0; i < n; i++) printf("%d ", a[i]);
    }
    // debug for(int i = 0; i < n; i++) printf("%d ", ordered[i]);

    int counter  = 0;
    for(int i = 0; i < n; i++){
        if(ordered[i] < ordered[i+1]) counter++;
    }

    printf("%d", counter);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1005; int a[MAXN], ordered[MAXN]; bool catched[MAXN];

int main(){
    int n; scanf("%d", &n);

    //formats the arrays
    for(int i = 0; i < MAXN; i++){
        a[i] = 0;
        ordered[i] = 0;
        catched[i] = false;
    }

    //populates 'a' array with the inputs
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);

    //sorts the 'a' array
    sort(a, a+n);
    //debug for(int i = 0; i < n; i++) printf("%d ", a[i]);

    //sets the faulting variable to the number of inputs and a 'j' variable to 0
    int faulting = n, j = 0;

    //while there are elements which weren't counted yet
    while(faulting > 0){
        //takes every element different from its precedent
        for(int i = 0; i < n; i++){
            if((i == 0 || a[i] != a[i-1]) && a[i]!=0){
                //debug printf("%d ", a[i]);
                ordered[j++] = a[i];
                catched[i] = true;
                faulting--;
            }
        } //debug printf("\n");

        /*printf("ordered: "); for(int i = 0; i < n; i++){
            printf("%d ", ordered[i]);
        } printf("\n");*/

        bool allEqual = true;

        //if there are still elements which weren't catched
        if(faulting > 0){
            //populates the 'a' array with the remaining
            int k = 0;
            for(int i = 0; i < n; i++){
                if(catched[i] == false){
                    a[k++] = a[i];
                }
            }

            //formats the array after what matters
            for(int i = k; i < MAXN; i++) a[i] = 0;

            //formats the catched array
            for(int i = 0; i < MAXN; i++) catched[i] = false;

            //verifies if there are different elements in the array
            for(int i = 1; i < n; i++){
                if(a[i-1] == 0) break;
                if(a[i] != 0 && a[i] != a[i-1]) allEqual = false;
            } if(allEqual) break;
        }

        /*printf("a: "); for(int i = 0; i < n; i++){
            printf("%d ", a[i]);
        } printf("\n");*/
    }
    // debug for(int i = 0; i < n; i++) printf("%d ", ordered[i]);

    int counter  = 0;
    for(int i = 0; i < n; i++){
        if(ordered[i] < ordered[i+1]) counter++;
    }

    printf("%d\n", counter);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1005;
int a[MAXN], ordered[MAXN];
bool catched[MAXN];

int main(){
    int n; scanf("%d", &n);

    //formats the arrays
    for(int i = 0; i < MAXN; i++){
        a[i] = 0;
        ordered[i] = 0;
        catched[i] = false;
    }

    //populates 'a' array with the inputs
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);

    //sorts the 'a' array
    sort(a, a+n);

    //sets the faulting variable to the number of inputs and an 'j' variable to 0
    int faulting = n, j = 0;

    //while there are elements which weren't counted yet
    while(faulting > 0){

        //takes every element different from its precedent
        for(int i = 0; i < n; i++){
            if(i == 0 || a[i] != a[i-1]){
                ordered[j++] = a[i];
                catched[i] = true;
                faulting--;
            }
        }

        bool allEqual = true;

        if(faulting > 0){
            //populates the 'a' array with the remaining
            int k = 0;
            for(int i = 0; i < n; i++){
                if(catched[i] == false) a[k++] = a[i];
            }

            //formats the array after what matters
            for(int i = k; i < MAXN; i++) a[i] = 0;

            //formats the catched array
            for(int i = 0; i < MAXN; i++) catched[i] = false;

            //verifies if there are different elements in the array
            for(int i = 1; i < n; i++){
                if(a[i-1] == 0) break;
                if(a[i] != 0 && a[i] != a[i-1]) allEqual = false;
            } if(allEqual) break;
        }
    }

    for(int i = 0; i < n; i++) printf("%d ", ordered[i]);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1005; int a[MAXN], ordered[MAXN]; bool catched[MAXN];

int main(){
    int n; scanf("%d", &n);

    for(int i = 0; i < MAXN; i++){
        a[i] = 0;
        ordered[i] = 0;
        catched[i] = false;
    }

    for(int i = 0; i < n; i++) scanf("%d", &a[i]);

    sort(a, a+n);

    int faulting = n, j = 0;

    while(faulting > 0){
        for(int i = 0; i < n; i++){
            if((i == 0 || a[i] != a[i-1]) && a[i]!=0){
                ordered[j++] = a[i];
                catched[i] = true;
                faulting--;
            }
        }

        bool allEqual = true;

        if(faulting > 0){
            int k = 0;
            for(int i = 0; i < n; i++){
                if(catched[i] == false){
                    a[k++] = a[i];
                }
            }

            for(int i = k; i < MAXN; i++) a[i] = 0;

            for(int i = 0; i < MAXN; i++) catched[i] = false;

            for(int i = 1; i < n; i++){
                if(a[i-1] == 0) break;
                if(a[i] != 0 && a[i] != a[i-1]) allEqual = false;
            } if(allEqual) break;
        }
    }

    int counter  = 0;
    for(int i = 0; i < n; i++){
        if(ordered[i] < ordered[i+1]) counter++;
    }

    printf("%d\n", counter);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n, x;
int amount[1005];
int amountRepeated[1005];

int main() {
	scanf("%d", &n);
	int total;
	for(int i = 0; i < n; i++) {
		scanf("%d", &x);
		if(amountRepeated[++amount[x]]++ > 0) {
			total++;
		}
	}
	printf("%d", total);

	return 0;
}
// 1507985324845


#include <bits/stdc++.h>
#define debug(x) printf("%d\n", x)
#define x first
#define y second

using namespace std;

int main(){
	int n, num, troca;
	vector<int> resp;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> num;
		resp.push_back(num);
	}
	sort(resp.begin(), resp.end());

	for(int i = 1; i<n;i++){
		if(resp[i] == resp[i-1]){
			for(int j = i; j<n;j++){
				if(resp[j] > resp[i]){
					troca = resp[j];
					resp[j] = resp[i];
					resp[i] = troca;
				}
			}
		}
	}
	num = 0;
	for(int i = 1; i<n ;i++){
		if(resp[i] > resp[i-1]){
			num++;
		}
	}

	cout << num << endl;

	return 0;
}
// 1507983849801


#include <bits/stdc++.h>

using namespace std;

int seq[1010];

int main(){

	int n;

	scanf("%d", &n);

	for (int i=0; i<n;i++) scanf("%d", &seq[i]);

	sort(seq,seq+n);

	int ans=0;
	vector<int> f;
	f.push_back(seq[0]);
	int k=1;
	while(k<n){
		while(seq[k]==-1) k++;
		f.push_back(seq[k]);
		seq[k] = -1;
		k++;
		for (int i=k; i<n; i++) {
			if (seq[i] > f[f.size()-1] && seq[i] != -1) {
				f.push_back(seq[i]);
			}
		}
	}

	for (int i=1; i<n; i++) if (f[i] > f[i-1]) ans++;

	printf("%d\n", ans);
	return 0;
}
// 1507994275916


#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int array[1000+5];

int main()
{
	int n;
	cin>>n;

	for(int i =0;i<n;i++){
		cin>>array[i];
	}
	int contador=0;
	bool teste=false;
	for(int i =0;i<n;i++){
		for(int j=0;j<n && !teste;j++){
			if( i!=j && array[i]<array[j]){
				contador++;
				teste=true;
			}
		}
		teste = false;
	}

	cout<<contador;
	return 0;
}

// 1507988713931


#include <bits/stdc++.h>

using namespace std;

int seq[1010];

int main(){

	int n;

	scanf("%d", &n);

	for (int i=0; i<n;i++) scanf("%d", &seq[i]);

	sort(seq,seq+n);

	int ans=0;
	vector<int> f;
	int k=0;
	while(k<n){

		while(seq[k]==-1) k++;

		f.push_back(seq[k]);
		seq[k] = -1;
		k++;

		for (int i=k; i<n; i++) {
			if (seq[i] > f[f.size()-1] && seq[i] != -1) {
				f.push_back(seq[i]);
				seq[i] = -1;
			}
		}
	}

	for (int i=1; i<n; i++) if (f[i-1] < f[i]) ans++;

	printf("%d\n",ans);
	return 0;
}
// 1507996405299


#include <bits/stdc++.h>

using namespace std;

int seq[1010];

int main(){

	int n;

	scanf("%d", &n);

	for (int i=0; i<n;i++) scanf("%d", &seq[i]);

	sort(seq,seq+n);

	int ans=0;

	for (int i=0; i<n; i++) {
		if (seq[i] != -1) {
			int j;
			for (j=i+1; j<n; j++){
				if (seq[j]>seq[i]) {
					ans++;
					seq[i] = -1;
					seq[j] = -1;
				}
			}
		}
	}

	printf("%d\n", ans);
	return 0;
}
// 1507987412876


#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define file freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define done cin.tie(0);std::ios::sync_with_stdio(false);
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define mp make_pair
#define pb push_back
#define CLR(a) memset(a,0,sizeof(a))
#define all(c) c.begin(), c.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define popcon(a) __builtin_popcount(a)
//ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
//ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
//bool cmp(pair<int,int>x,pair<int,int>y)
//{if (x.first==y.first) return x.second<y.second;return x.first>y.first;}
//int dx[]={1, -1, 0, 0, 1, -1, 1, -1};
//int dy[]={0, 0, 1, -1, 1, -1, -1, 1};
//int dr[]={-1,1,0,0};
//int dc[]={0,0,-1,1};
int main()
{
    done
    int x,z,c=0;
    cin>>x;
    vector<int>vec;
    map<int,int>mop;
    rep(i,x){
    cin>>z;mop[z]++;}
    forit(it,mop)
    if(it->second)
        vec.pb(it->second);
    sort(all(vec));
    rep(i,vec.size()-1)
    c+=min(vec[i],vec[i+1]);
    cout<<c<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define file freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define done cin.tie(0);std::ios::sync_with_stdio(false);
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define mp make_pair
#define pb push_back
#define CLR(a) memset(a,0,sizeof(a))
#define all(c) c.begin(), c.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define popcon(a) __builtin_popcount(a)
//ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
//ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
//bool cmp(pair<int,int>x,pair<int,int>y)
//{if (x.first==y.first) return x.second<y.second;return x.first>y.first;}
//int dx[]={1, -1, 0, 0, 1, -1, 1, -1};
//int dy[]={0, 0, 1, -1, 1, -1, -1, 1};
//int dr[]={-1,1,0,0};
//int dc[]={0,0,-1,1};
int main()
{
    done
    int x;
    cin>>x;
    vector<int>vec(x);
    rep(i,x)
    cin>>vec[i];
    sort(all(vec));
    stack<int>s;
    s.push(vec[0]);
    int c=0;
    for(int i=1;i<x;i++)
    {
        if(vec[i]>s.top()){
            c++,s.pop();if(s.empty())s.push(vec[i]);}
        else
            s.push(vec[i]);
    }
    cout<<c<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define file freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define done cin.tie(0);std::ios::sync_with_stdio(false);
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define mp make_pair
#define pb push_back
#define CLR(a) memset(a,0,sizeof(a))
#define all(c) c.begin(), c.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define popcon(a) __builtin_popcount(a)
//ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
//ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
//bool cmp(pair<int,int>x,pair<int,int>y)
//{if (x.first==y.first) return x.second<y.second;return x.first>y.first;}
//int dx[]={1, -1, 0, 0, 1, -1, 1, -1};
//int dy[]={0, 0, 1, -1, 1, -1, -1, 1};
//int dr[]={-1,1,0,0};
//int dc[]={0,0,-1,1};
int main()
{
    done
    int x,z,c=0;
    cin>>x;
    vector<int>vec;
    map<int,int>mop;
    rep(i,x){
    cin>>z;mop[z]++;}
    forit(it,mop)
    if(it->second)
        vec.pb(it->second);
    rep(i,vec.size()-1)
    c+=min(vec[i],vec[i+1]);
    cout<<c<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define file freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define done cin.tie(0);std::ios::sync_with_stdio(false);
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define mp make_pair
#define pb push_back
#define CLR(a) memset(a,0,sizeof(a))
#define all(c) c.begin(), c.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define popcon(a) __builtin_popcount(a)
//ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
//ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
//bool cmp(pair<int,int>x,pair<int,int>y)
//{if (x.first==y.first) return x.second<y.second;return x.first>y.first;}
//int dx[]={1, -1, 0, 0, 1, -1, 1, -1};
//int dy[]={0, 0, 1, -1, 1, -1, -1, 1};
//int dr[]={-1,1,0,0};
//int dc[]={0,0,-1,1};
int main()
{
    done
    int x;
    cin>>x;
    vector<int>vec(x);
    set<int>st;
    rep(i,x){
    cin>>vec[i];st.insert(vec[i]);}
    int c=0,prev=*st.begin();
    st.erase(prev);
    set<int>::iterator it ;
    while(st.size())
    {
        it=st.upper_bound(prev);
        if(it==st.end())
            prev=*st.begin(),st.erase(prev);
        else
            c++,prev=*it,st.erase(*it);
    }
    cout<<c<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define file freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define done cin.tie(0);std::ios::sync_with_stdio(false);
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define mp make_pair
#define pb push_back
#define CLR(a) memset(a,0,sizeof(a))
#define all(c) c.begin(), c.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define popcon(a) __builtin_popcount(a)
//ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
//ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
//bool cmp(pair<int,int>x,pair<int,int>y)
//{if (x.first==y.first) return x.second<y.second;return x.first>y.first;}
//int dx[]={1, -1, 0, 0, 1, -1, 1, -1};
//int dy[]={0, 0, 1, -1, 1, -1, -1, 1};
//int dr[]={-1,1,0,0};
//int dc[]={0,0,-1,1};
int main()
{
    done
    int x,z,c=0,max;
    cin>>x;
    vector<int>vec(x),ans;
    map<int,int>mop;
    rep(i,x)
    cin>>vec[i];
    sort(all(vec));
    rep(i,x)
    {
        if(vec[i]==-1)
            continue;
        max=vec[i];
        for(int j=1;j<x;j++)
        {
            if(vec[j]>max)
            {
                max=vec[j],c++,vec[j]=-1;
            }
        }
    }
    cout<<c<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define file freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define done cin.tie(0);std::ios::sync_with_stdio(false);
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define mp make_pair
#define pb push_back
#define CLR(a) memset(a,0,sizeof(a))
#define all(c) c.begin(), c.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define popcon(a) __builtin_popcount(a)
//ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
//ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
//bool cmp(pair<int,int>x,pair<int,int>y)
//{if (x.first==y.first) return x.second<y.second;return x.first>y.first;}
//int dx[]={1, -1, 0, 0, 1, -1, 1, -1};
//int dy[]={0, 0, 1, -1, 1, -1, -1, 1};
//int dr[]={-1,1,0,0};
//int dc[]={0,0,-1,1};
int main()
{
    done
    int x;
    cin>>x;
    vector<int>vec(x);
    multiset<int>st;
    rep(i,x){
    cin>>vec[i];st.insert(vec[i]);}
    int c=0,prev=*st.begin();
    st.erase(st.begin());
    multiset<int>::iterator it ;
    while(st.size())
    {
        it=st.upper_bound(prev);
        if(it==st.end())
            prev=*st.begin(),st.erase(st.begin());
        else
            c++,prev=*it,st.erase(it);
    }
    cout<<c<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define file freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define done cin.tie(0);std::ios::sync_with_stdio(false);
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define mp make_pair
#define pb push_back
#define CLR(a) memset(a,0,sizeof(a))
#define all(c) c.begin(), c.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define popcon(a) __builtin_popcount(a)
//ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
//ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
//bool cmp(pair<int,int>x,pair<int,int>y)
//{if (x.first==y.first) return x.second<y.second;return x.first>y.first;}
//int dx[]={1, -1, 0, 0, 1, -1, 1, -1};
//int dy[]={0, 0, 1, -1, 1, -1, -1, 1};
//int dr[]={-1,1,0,0};
//int dc[]={0,0,-1,1};
int main()
{
    done
    int x;
    cin>>x;
    vector<int>vec(x);
    rep(i,x)
    cin>>vec[i];
    stack<int>s;
    s.push(vec[0]);
    int c=0;
    for(int i=1;i<x;i++)
    {
        if(vec[i]>s.top()){
            c++,s.pop();if(s.empty())s.push(vec[i]);}
        else
            s.push(vec[i]);
    }
    cout<<c<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define maxn 1001

int p[maxn], a[maxn];

int main()
{
	int n, i, k, ret = 0;
	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%d", &k);
		p[k]++;
	}
	sort(p + 1, p + maxn);
	for(i = 1; i < maxn; i++)
		ret += (p[i] - p[i - 1])*(maxn - i);
	printf("%d", ret);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define maxn 1001

int p[maxn], a[maxn];

int main()
{
	int n, i, k, ret = 0;
	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%d", &k);
		a[k]++;
	}
	for(i = 1; i <= n; i++)
		p[a[i]]++;
	sort(p, p + n);
	k = 0;
	for(i = 0; i < n; i++)
	{
		ret += max(0, p[i] - k - 1);
		k += p[i] - k;
	}
	printf("%d", ret);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define maxn 1001

int p[maxn], a[maxn];

int main()
{
	int n, i, k, ret = 0;
	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%d", &k);
		p[k]++;
	}
	sort(p + 1, p + maxn);
	for(i = 1; i < maxn; i++)
		ret += (p[i] - p[i - 1])*(maxn - i - 1);
	printf("%d", ret);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define maxn 1000

int p[maxn];

int main()
{
	int n, i, ret = 0;
	scanf("%d", &n);
	for(i = 0; i < n; i++)
		scanf("%d", p + i);
	sort(p, p + n);
	for(i = 1; i < n; i++)
		ret += p[i] > p[i - 1];
	printf("%d", ret);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define maxn 1001

int p[maxn];

int main()
{
	int n, i, k, ret = 0;
	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%d", &k);
		p[k]++;
	}
	sort(p, p + n);
	k = 0;
	for(i = 0; i < n; i++)
	{
		ret += max(0, p[i] - k - 1);
		k += p[i] - k;
	}
	printf("%d", ret);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define maxn 1001

int p[maxn], a[maxn];

int main()
{
	int n, i, k, ret = 0;
	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%d", &k);
		p[k]++;
	}
	sort(p + 1, p + n + 1);
	for(i = 1; i <= n; i++)
		ret += (p[i] - p[i - 1])*(n - i);
	printf("%d", ret);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define maxn 1001

int p[maxn];

int main()
{
	int n, i, k, ret = 0;
	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%d", &k);
		p[k]++;
	}
	sort(p + 1, p + n + 1);
	for(i = 1; i <= n; i++)
		ret += max(0, p[i] - p[i - 1] - 1);
	printf("%d", ret);
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

const int max_n = 1000;
int main()
{
	int n;
	cin >> n;
	int beauty[max_n];
	for (int i = 0; i < n; i++)
	{
		cin >> beauty[i];
	}
	sort(beauty, beauty + n);
	int diff = 0;
	vector<int> a;
	for (int i = 1; i < n; i++)
	{
		if (beauty[i] != beauty[i - 1])
			diff++;
		else
			a.push_back(beauty[i]);
	}
	while(a.size() > 0)
	{
		vector<int> b;
		for (int i = 1; i < a.size(); i++)
		{
		if (a[i] != a[i - 1])
			diff++;
		else
			b.push_back(a[i]);
		}
		a = b;

	}
	cout << diff << endl;

	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

const int max_n = 1000;
int main()
{
	int n;
	cin >> n;
	int beauty[max_n];
	for (int i = 0; i < n; i++)
	{
		cin >> beauty[i];
	}
	sort(beauty, beauty + n);
	int diff = 1;
	for (int i = 1; i < n; i++)
	{
		if (beauty[i] != beauty[i - 1])
			diff++;
	}

	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

const int max_n = 1000;
int main()
{
	int n;
	cin >> n;
	int beauty[max_n];
	for (int i = 0; i < n; i++)
	{
		cin >> beauty[i];
	}
	sort(beauty, beauty + n);
	int diff = 1;
	for (int i = 1; i < n; i++)
	{
		if (digit[i] != digit[i - 1])
			diff++;
	}

	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

const int max_n = 1000;
int main()
{
	int n;
	cin >> n;
	int beauty[max_n];
	for (int i = 0; i < n; i++)
	{
		cin >> beauty[i];
	}
	sort(beauty, beauty + n);
	int diff = 0;
	for (int i = 1; i < n; i++)
	{
		if (beauty[i] != beauty[i - 1])
			diff++;
	}
	cout << diff << endl;

	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

const int max_n = 1000;
int main()
{
	int n;
	cin >> n;
	int beauty[max_n];
	for (int i = 0; i < n; i++)
	{
		cin >> beauty[i];
	}
	sort(beauty, beauty + n);
	int diff = 1;
	for (int i = 1; i < n; i++)
	{
		if (beauty[i] != beauty[i - 1])
			diff++;
	}
	cout << diff << endl;

	return 0;
}


#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
int main()
{
    int x,n,i,minii=-1,count[1000];
    vector<int> a;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>x;
        a.push_back(x);

    }
    sort(a.begin(),a.end());
    for(i=0;i<n;i++){
        count[a[i]]+=1;
    }
    for(i=0;i<100;i++){
        if(minii<count[i])
        minii=count[i];
    }
    cout<<n-minii;
    return 0;
}


#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
int main()
{
    int x,n,i,minii=-1,count[1005];
    vector<int> a;
    cin>>n;
    for(i=0;i<1005;i++){
        count[i]=0;
    }
    for(i=0;i<n;i++)
    {
        cin>>x;
        a.push_back(x);

    }
    sort(a.begin(),a.end());
    for(i=0;i<n;i++){
        count[a[i]]+=1;
    }
    for(i=0;i<1005;i++){
        if(minii<count[i])
        minii=count[i];
    }
    cout<<n-minii;
    return 0;
}


#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
int main()
{
    int x,n,i,minii=-1,count[1000];
    vector<int> a;
    cin>>n;
    for(i=0;i<1000;i++){
        count[i]=0;
    }
    for(i=0;i<n;i++)
    {
        cin>>x;
        a.push_back(x);

    }
    sort(a.begin(),a.end());
    for(i=0;i<n;i++){
        count[a[i]]+=1;
    }
    for(i=0;i<1000;i++){
        if(minii<count[i])
        minii=count[i];
    }
    cout<<n-minii;
    return 0;
}


#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
int main()
{
    int x,n,i,minii=-1,count[1000];
    vector<int> a;
    cin>>n;
    for(i=0;i<1000){
        count[i]=0;
    }
    for(i=0;i<n;i++)
    {
        cin>>x;
        a.push_back(x);

    }
    sort(a.begin(),a.end());
    for(i=0;i<n;i++){
        count[a[i]]+=1;
    }
    for(i=0;i<1000;i++){
        if(minii<count[i])
        minii=count[i];
    }
    cout<<n-minii;
    return 0;
}


#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
int main()
{
    int n,i,minii=-1,count[1000];
    vector<int> a;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>x;
        a.push_back(x);

    }
    sort(a.begin(),a.end());
    for(i=0;i<n;i++){
        count[a[i]]+=1;
    }
    for(i=0;i<100;i++){
        if(minii<count[i])
        minii=count[i];
    }
    cout<<n-minii;
    return 0;
}


#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
int main()
{
    int n,x,i,minii=-1,count[1000];
    vector<int> a;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>x;
        a.push_back(x);

    }
    sort(a.begin(),a.end());
    for(i=0;i<n;i++){
        count[a[i]]+=1;
    }
    for(i=0;i<1000;i++){
        if(minii<count[i])
        minii=count[i];
    }
    cout<<n-minii;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int rep[1001] ;
int main()
{
   vector< int > w ;
   int n ;
   cin>>n ;
   int p ;
   for( int i = 0 ; i < n ; i++ ) { scanf("%d" , &p) ; if( rep[p] == 0 )w.push_back(p) ; rep[p]++ ; }
   int ans = 0;
   sort( w.begin() , w.end() ) ;
   for( int i = 1 ; i < w.size() ; i++ )
       { if( w[i] > w[i-1] )ans+=min(rep[w[i]] , rep[w[i-1]] ) ;}
   cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int rep[1001] ;
int main()
{
    vector< int > w ;
    int n ;
    cin>>n ;
    int p ;
    for( int i = 0 ; i < n ; i++ )
    {
        scanf("%d" , &p) ;
        if( rep[p] == 0 )w.push_back(p) ;
        rep[p]++ ;
    }
    int ans = 0;
    sort( w.begin() , w.end() ) ;
    for( int i = 1 ; i < w.size() ; i++ )
    {
        if( w[i] > w[i-1] )
        {
            ans+=min(rep[w[i]] , rep[w[i-1]] ) ;
            rep[w[i]]-=min(rep[w[i]] , rep[w[i-1]] ) ;
            if(rep[w[i]] == 0)rep[w[i]]++;
        }
    }
        cout<<ans;
        return 0;
    }


#include <bits/stdc++.h>

using namespace std;
int rep[1001] ;
int main()
{
   int n ;
   cin>>n ;
   int p[n] ;
   for( int i = 0 ; i < n ; i++ ) { scanf("%d" , &p[i]) ; rep[p[i]]++ ; }
   sort( p , p+n ) ;
   int ans = 0;
   for( int i = 1 ; i < n ; i++ )
       { if( p[i] > p[i-1] )ans+=min(rep[p[i]] , rep[p[i-1]] ) ;}
   cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    vector< int > w ;
    int n ;
    cin>>n ;
    int p ;
    for( int i = 0 ; i < n ; i++ )
    {
        scanf("%d" , &p) ;
        w.push_back(p) ;
    }
    int ans = 0;
    sort( w.begin() , w.end() ) ;
    for( int i = 0 ; i < w.size() ; i++ )
    {
        if( w[i] == -1 )continue ;
        for( int j = i+1 ; j < n ; j++ )
        {
            if( w[j] == -1 ) continue ;
            if( w[j] > w[i] ){ ans++ ; w[j] = -1 ; }
        }
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int rep[1001] ;
int main()
{
    vector< int > w ;
    int n ;
    cin>>n ;
    int p ;
    for( int i = 0 ; i < n ; i++ )
    {
        scanf("%d" , &p) ;
        rep[p]++ ;
    }
    int ans = 0 , f = 1 ;
    while( f )
    {
        f = 0 ;
        for( int i = 1 ; i <= 1001 ; i++ )
        {
            if( rep[i] )
            {
                f = 1 ;
                w.push_back(i) ;
                rep[i]-- ;
            }
        }
    }
    for( int i = 1 ; i < w.size() ; i++ )
    {
        if( w[i] > w[i-1] )
            ans++ ;
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int rep[1001] ;
int main()
{
   vector< int > w ;
   int n ;
   cin>>n ;
   int p ;
   for( int i = 0 ; i < n ; i++ ) { scanf("%d" , &p) ; if( rep[p] == 0 )w.push_back(p) ; rep[p]++ ; }
   int ans = 0;
   for( int i = 1 ; i < w.size() ; i++ )
       { if( w[i] > w[i-1] )ans+=min(rep[w[i]] , rep[w[i-1]] ) ;}
   cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

#define fr(a, b, c) for(int a = b; a < c; ++a)
#define pb push_back
#define MOD 1713371337
#define fi first
#define sec second
#define EPS 1e-6
#define dbg(x) cerr << #x << " = " << x << endl

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;
typedef vector<int> vi;
typedef vector<ii> vii;

int const inf = 0x3f3f3f3f;

int arr[1010];
int num[1010];

int main() {
	int n;
	scanf("%d", &n);

	memset(num, 0, sizeof num);

    for(int i = 0; i < n; i++) {
    	scanf("%d", &arr[i]);
    	num[arr[i]]++;
    }

    int resp = 0;

    for(int i = n; i >= 1; i--) {
    	bool entrou = false;
    	for(int j = 0; j <= 1000; j++) {
    		if(num[j] == i) {
    			num[j]--;
    			resp++;
    			entrou = true;
    		}
    	}
    	if(entrou) resp--;
    }

    printf("%d\n", resp);

    return 0;
}
// 1507905693772


#include <bits/stdc++.h>
#define debug(x) printf("%d\n", x)
#define x first
#define y second

using namespace std;

int main(){
	int n, num, save;
	vector<int> resp, check;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> num;
		resp.push_back(num);
	}
	sort(resp.begin(), resp.end());

	for(int i = 0; i<n-1; i++){
		if(resp[i]!=-1){
			check.push_back(resp[i]);
		}
		for(int j = i; j<n;j++){
			if(resp[j] > resp[i] && resp[j] != save){
				check.push_back(resp[j]);
				save = resp[j];
				resp[j] = -1;
			}
		}
		save = -1;
	}

	num = 0;
	for(int i = 1; i<check.size() ;i++){
		if(check[i] > check[i-1]){
			num++;
		}
	}
	cout << num << endl;

	return 0;
}
// 1507986212873


#include <bits/stdc++.h>

using namespace std;

#define lli long long int

int main(){
	int n;

	cin >> n;
	int a[n], qtd = 0;

	for(int c = 0; c < n; c++)
		cin >> a[c];

	sort(a, a + n);

	//cout << a[0];
	for(int c = 1; c < n; c++){
		if(a[c] == a[c - 1]){
			//cout << " " << a[c];
		//}
		//else{
			for(int i = c + 1; i < n; i++){
				if(a[i] != a[c]){
					swap(a[i], a[c]);
					break;
				}
			}
			//cout << " " << a[c];
		}
	}

	for(int c = 1; c < n; c++)
		if(a[c] > a[c - 1]) qtd++;

	cout << qtd << endl;

}
// 1507988851978


#include <bits/stdc++.h>
using namespace std;
int vet[1000];
int main(){
	int n;
	int b;
	int count = 0;
	scanf("%d",&n);

	for(int i = 0;i<n;i++)
		scanf("%d",&vet[i]);
	sort(vet,vet+n);
	int l,r;
	l = 0;
	r = 1;
	while(r<=n){
		if(vet[l] < vet[r]){
			count+=1;
			//cout << vet[l] << " "<<vet[r]<<endl;
			l++;
			r++;

		}
		else
			r+=1;

	}

	cout << count<<endl;

	return 0;
}

// 1507991524475


#include <bits/stdc++.h>

using namespace std;

int n;
int a[1000];

int main()
{
    int t,prevt,c=0,minc=1001;
    cin >> n;

    for(int i=0;i<n;i++){
        cin >> t;
        if(t<minc)
            minc=t;
        a[t-1]++;
    }

    for(int i=999;i>=0;i--){
        c+=a[i];
    }

    c-=a[minc-1];

    cout << c;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
vector<int> a;
vector<int> g[1000];

int main(){
    cin >> n;
    a.resize(n);
    for(int i=0;i<n;i++)
        cin >> a[i];

    sort(a.begin(),a.end());

    int prev=-1,u=0;

    for(int i=0;i<n;i++){
        if(a[i]!=prev){
            u=0;
            g[u].push_back(a[i]);
        }
        else{
            u++;
            g[u].push_back(a[i]);
        }
        prev = a[i];
    }

    int answer=0;
    for(int i=0;i<n;i++){
        if(g[i].size()!=0){
            answer+=g[i].size()-1;
        }
    }

    cout << answer;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
vector<int> a[1000];
int b[1000];

int main()
{
    int t,prevt,c=0,k;
    cin >> n;

    for(int i=0;i<n;i++){
        cin >> t;
        a[b[t]].push_back(t);
        b[t]++;

    }

    for(int i=0;i<1000;i++){
        if(a[i].size()!=0)
            c+=a[i].size()-1;
    }

    cout << c << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
pair<int,int> a[1000];

int main()
{
    int t,prevt,c=0;
    cin >> n;

    cin >> a[0].first;
    for(int i=1;i<n;i++){
        cin >> a[i-1].second;
        prevt=a[i-1].second;
        a[i].first=prevt;
    }

    for(int i=0;i<n-1;i++){
        if(a[i].first!=a[i].second)
            c++;
    }

    cout << c;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,t;
map<int,int> a;
int answer;

int main(){

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> t;
    a[t]++;
    if(a[t])==1)
      answer++;
  }

  cout << answer-1;

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,t;
map<int,int> a;
int answer;

int main(){

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> t;
    a[t]++;
    if(a[t]==1)
      answer++;
  }

  cout << answer-1;

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n;
int a[1000];
int b[1000];

int main()
{
    int t,prevt,c=0,minc=1001;
    cin >> n;

    for(int i=0;i<n;i++){
        cin >> a[i];
        b[i]=a[i];
    }

    for(int i=0;i<n-1;i++){
        if(a[i]!=b[i+1])
            c++;
    }

    cout << c << endl;

    return 0;
}


#include<bits/stdc++.h>
#define loop(i,n) for(i=0;i<n;i++)
using namespace std;
bool f = false;
int main()
{
	vector <int> v(1003);
	int n,x,mx=0,i;
	cin >> n;
loop(i,n)
	{
		cin >> x;
		v[x]++;
		cout<<v[x];
		mx = max(v[x], mx);
	}
	cout << n - mx;
	return 0;
}


#include<bits/stdc++.h>
#define loop(i,n) for(i=0;i<n;i++)
using namespace std;
int main(){ int n,r=0,i;
cin>>n;
int x[n];
loop(i,n){
cin>>x[i];
if(x[i]==x[i-1])
x[i]=0;}
sort(x,x+n);
loop(i,n)
if(x[i]<x[i+1])
r++;
cout<<r;}


#include<bits/stdc++.h>
#define loop(i,n) for(i=0;i<n;i++)
using namespace std;
int main(){ int n,r=0,i;
cin>>n;
//int x[n];
int *x=new int[n];
loop(i,n){
cin>>x[i];
if(x[i]==x[i-1])
x[i]=0;}
sort(x,x+n);
loop(i,n)
if(x[i]<x[i+1])
r++;
cout<<r;
return 0;}


#include <bits/stdc++.h>
#define  pb             push_back
#define  mp             make_pair
#define  INF            0x3fffffff

using namespace std;

typedef long long ll;
typedef vector<vector<int> > graph;

const int MAX = 1000005;

void clean ( string &s ) {
    deque<char> d(s.begin(), s.end());
    while ( d.front() == '0' ) d.pop_front();
    while ( d.back() == '0' ) d.pop_back();
    s = string(d.begin(), d.end());
}

int main ( ) {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;

    int pos = s.find('.');
    if ( pos == string::npos ) {
        pos = s.size();
        s.pb('.');
    }
    clean(s);
    pos = s.find('.');

    s.erase(pos, 1);
    if ( pos == 0 ) {
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l == string::npos ) { cout << 0; return 0; }
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << -l - 1;
        else
            cout << s[l] << 'E' << -l - 1;
        return 0;
    }
    if ( pos == s.size() ) {
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << s.size() - r + (r - l - 1);
        else
            cout << s[l] << 'E' << s.size() - l - 1;
    } else {
        s.insert(pos, 1, '.');
        cout << s;
    }
}


#include <bits/stdc++.h>
#define  pb             push_back
#define  mp             make_pair
#define  INF            0x3fffffff

using namespace std;

typedef long long ll;
typedef vector<vector<int> > graph;

const int MAX = 1000005;

void clean ( string &s ) {
    deque<char> d(s.begin(), s.end());
    while ( d.front() == '0' ) d.pop_front();
    while ( d.back() == '0' ) d.pop_back();
    s = string(d.begin(), d.end());
}

int main ( ) {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;

    int pos = s.find('.');
    if ( pos == string::npos ) {
        pos = s.size();
        s.pb('.');
    }
    clean(s);
    pos = s.find('.');

    s.erase(pos, 1);
    if ( pos == 0 ) {
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l == string::npos ) { cout << 0; return 0; }
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << -l - 1;
        else
            cout << s[l] << 'E' << -l - 1;
        return 0;
    }
    if ( pos == s.size() ) {
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << s.size() - r + (r - l);
        else
            cout << s[l] << 'E' << s.size() - l - 1;
    } else {
        s.insert(pos, 1, '.');
        cout << s;
    }
}


#include <bits/stdc++.h>
#define  pb             push_back
#define  mp             make_pair
#define  INF            0x3fffffff

using namespace std;

typedef long long ll;
typedef vector<vector<int> > graph;

const int MAX = 1000005;

void clean ( string &s ) {
    deque<char> d(s.begin(), s.end());
    while ( d.front() == '0' ) d.pop_front();
    while ( d.back() == '0' ) d.pop_back();
    s = string(d.begin(), d.end());
}

int main ( ) {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;

    int pos = s.find('.');
    if ( pos == string::npos ) {
        pos = s.size();
        s.pb('.');
    }
    clean(s);
    pos = s.find('.');

    s.erase(pos, 1);
    if ( pos == 0 ) {
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l == string::npos ) { cout << 0; return 0; }
        if ( l + 1 == r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << -l - 1;
        else
            cout << s[l] << 'E' << -l - 1;
        return 0;
    }
    if ( pos == s.size() ) {
        if ( pos == 1 ) { cout << s; return 0; }
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << s.size() - r + (r - l - 1);
        else
            cout << s[l] << 'E' << s.size() - l - 1;
    } else {
        s.insert(pos, 1, '.');
        cout << s;
    }
}


#include <bits/stdc++.h>
#define  pb             push_back
#define  mp             make_pair
#define  INF            0x3fffffff

using namespace std;

typedef long long ll;
typedef vector<vector<int> > graph;

const int MAX = 1000005;

void clean ( string &s ) {
    deque<char> d(s.begin(), s.end());
    while ( d.front() == '0' ) d.pop_front();
    while ( d.back() == '0' ) d.pop_back();
    s = string(d.begin(), d.end());
}

int main ( ) {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;

    int pos = s.find('.');
    if ( pos == string::npos ) {
        pos = s.size();
        s.pb('.');
    }
    clean(s);
    pos = s.find('.');

    s.erase(pos, 1);
    if ( pos == 0 ) {
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l == string::npos ) { cout << 0; return 0; }
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << -l - 1;
        else
            cout << s[l] << 'E' << -l - 1;
        return 0;
    }
    if ( pos == s.size() ) {
        if ( pos == 1 ) { cout << s; return 0; }
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << s.size() - r + (r - l - 1);
        else
            cout << s[l] << 'E' << s.size() - l - 1;
    } else {
        s.insert(pos, 1, '.');
        cout << s;
    }
}


#include <bits/stdc++.h>
#define  pb             push_back
#define  mp             make_pair
#define  INF            0x3fffffff

using namespace std;

typedef long long ll;
typedef vector<vector<int> > graph;

const int MAX = 1000005;

void clean ( string &s ) {
    deque<char> d(s.begin(), s.end());
    while ( d.front() == '0' ) d.pop_front();
    while ( d.back() == '0' ) d.pop_back();
    s = string(d.begin(), d.end());
}

int main ( ) {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;

    int pos = s.find('.');
    if ( pos == string::npos ) {
        pos = s.size();
        s.pb('.');
    }
    clean(s);
    pos = s.find('.');

    s.erase(pos, 1);
    if ( pos == 0 ) {
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l == string::npos ) { cout << 0; return 0; }
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << -l - 1;
        else
            cout << s[l] << 'E' << -l - 1;
        return 0;
    }
    if ( pos == s.size() ) {
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << s.size() - r;
        else
            cout << s[l] << 'E' << s.size() - r - 1;
    } else {
        s.insert(pos, 1, '.');
        cout << s;
    }
}


#include <bits/stdc++.h>
#define  pb             push_back
#define  mp             make_pair
#define  INF            0x3fffffff

using namespace std;

typedef long long ll;
typedef vector<vector<int> > graph;

const int MAX = 1000005;

void clean ( string &s ) {
    deque<char> d(s.begin(), s.end());
    while ( d.front() == '0' ) d.pop_front();
    while ( d.back() == '0' ) d.pop_back();
    s = string(d.begin(), d.end());
}

int main ( ) {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;

    int pos = s.find('.');
    if ( pos == string::npos ) {
        pos = s.size();
        s.pb('.');
    }
    clean(s);
    pos = s.find('.');

    s.erase(pos, 1);
    if ( pos == 0 ) {
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l == string::npos ) { cout << 0; return 0; }
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << -l - 1;
        else
            cout << s[l] << 'E' << -l - 1;
        return 0;
    }
    if ( pos == s.size() ) {
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << r;
        else
            cout << s[l] << 'E' << s.size() - l - 1;
    } else {
        s.insert(pos, 1, '.');
        cout << s;
    }
}


#include <bits/stdc++.h>
#define  pb             push_back
#define  mp             make_pair
#define  INF            0x3fffffff

using namespace std;

typedef long long ll;
typedef vector<vector<int> > graph;

const int MAX = 1000005;

void clean ( string &s ) {
    deque<char> d(s.begin(), s.end());
    while ( d.front() == '0' ) d.pop_front();
    while ( d.back() == '0' ) d.pop_back();
    s = string(d.begin(), d.end());
}

int main ( ) {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;

    int pos = s.find('.');
    if ( pos == string::npos ) {
        pos = s.size();
        s.pb('.');
    }
    clean(s);
    pos = s.find('.');

    s.erase(pos, 1);
    if ( pos == 0 ) {
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l == string::npos ) { cout << 0; return 0; }
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << -l - 1;
        else
            cout << s[l] << 'E' << -l - 1;
        return 0;
    }
    if ( pos == s.size() ) {
        if ( pos == 1 ) { cout << s; return 0; }
        int l = s.find_first_not_of('0');
        int r = s.find_last_not_of('0');
        if ( l != r )
            cout << s[l] << '.' << s.substr(l + 1, r - l) << 'E' << s.size() - r + (r - l - 1);
        else
            cout << s[l] << 'E' << s.size() - l - 1;
    } else {
        if ( pos == 1 ) {
            s.insert(pos, 1, '.');
            cout << s; return 0;
        }
        cout << s[0] << '.' << s.substr(1, s.size() - 1) << 'E' << pos - 1;
    }
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
string s;
int po=-1;
char str[1000010];
int st,ed;
int main()
{
	scanf("%s",&str);
	s=str;
	for (int i=0;i<s.size();i++) if (s[i]=='.') po=i;
	st=0,ed=s.size()-1;
	while (s[st]=='0' && st!=s.size()-1 && st!=po-1) st++;
	while (s[ed]=='0' && ed!=st && po!=-1 && ed!=po) ed--;
	if (po==st) s.insert(s.begin()+st,'0'),po++,ed++;
	if (ed==po) ed--,po=-1;
	/*for (int i=st;i<=ed;i++) cout <<s[i];
	cout <<"\n";*/
	if (po==-1)
	{
		printf("%c",s[st]);
		bool fl=0;
		for (int i=st+1;i<=ed;i++) fl|=(s[i]!='0');
		if (fl) printf(".%s",s.substr(st+1,ed-st+1).c_str());
		if (st!=ed) printf("E%d",ed-st);
		return 0;
	}
	else
	{
		if (po==st+1 && s[st]=='0')
		{
			int t=-1;
			for (int i=st;i<=ed;i++)
			{
				if (s[i]!='0' && s[i]!='.')
				{
					t=i;
					break;
				}
			}
			if (t==-1)
			{
				cout <<"0";
				return 0;
			}
			printf("%c",s[t]);
			bool fl=0;
			for (int i=t+1;i<=ed;i++) fl|=(s[i]!='0');
			if (fl) printf(".%s",s.substr(t+1,ed-t+1).c_str());
			if (st!=ed) printf("E%d",po-t);
			return 0;
		}
		printf("%c.",s[st]);
		for (int i=st+1;i<=ed;i++)
		{
			if (i==po) continue;
			printf("%c",s[i]);
		}
		if (po!=st+1) printf("E%d",po-st-1);
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m;
vector<int> v[1000010];
int a[1000010];
bool visit[1000010];
vector<int> v1,v2;
void dfs(int x)
{
	visit[x]=1;
	for (int i=0;i<v[x].size();i++)
	{
		int xi=v[x][i];
		if (!visit[xi]) dfs(xi);
	}
	v1.push_back(x),v2.push_back(a[x]);
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=0;i<n;i++) scanf("%d",&a[i]);
	for (int i=0;i<m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		x--,y--;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	for (int i=0;i<n;i++)
	{
		if (visit[i]) continue;
		v1.clear(),v2.clear();
		dfs(i);
		sort(v1.begin(),v1.end());
		sort(v2.begin(),v2.end());
		for (int j=v1.size()-1;j>=0;j--) a[v1[j]]=v2[v2.size()-1-j];
	}
	for (int i=0;i<n;i++) printf("%d ",a[i]);
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
string s;
int po=-1;
char str[1000010];
int st,ed;
int main()
{
	scanf("%s",&str);
	s=str;
	for (int i=0;i<s.size();i++) if (s[i]=='.') po=i;
	st=0,ed=s.size()-1;
	while (s[st]=='0' && st!=s.size()-1 && st!=po-1) st++;
	while (s[ed]=='0' && ed!=st && po!=-1 && ed!=po) ed--;
	if (ed==po) ed--,po=-1;
	if (po==st) s.insert(s.begin()+st,'0'),po++,ed++;
	/*for (int i=st;i<=ed;i++) cout <<s[i];
	cout <<"\n";*/
	if (po==-1)
	{
		printf("%c",s[st]);
		bool fl=0;
		for (int i=st+1;i<=ed;i++) fl|=(s[i]!='0');
		if (fl) printf(".%s",s.substr(st+1,ed-st+1).c_str());
		if (st!=ed) printf("E%d",ed-st);
	}
	else
	{
		if (po==st+1 && s[st]=='0')
		{
			int t=-1;
			for (int i=st;i<=ed;i++)
			{
				if (s[i]!='0' && s[i]!='.')
				{
					t=i;
					break;
				}
			}
			if (t==-1)
			{
				cout <<"0";
				return 0;
			}
			printf("%c",s[t]);
			bool fl=0;
			for (int i=t+1;i<=ed;i++) fl|=(s[i]!='0');
			if (fl) printf(".%s",s.substr(t+1,ed-t+1).c_str());
			if (st!=ed) printf("E%d",po-t);
			return 0;
		}
		printf("%c.",s[st]);
		for (int i=st+1;i<=ed;i++)
		{
			if (i==po) continue;
			printf("%c",s[i]);
		}
		if (po!=st+1) printf("E%d",po-st-1);
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
string s;
int po=-1;
char str[1000010];
int st,ed;
int main()
{
	scanf("%s",&str);
	s=str;
	for (int i=0;i<s.size();i++) if (s[i]=='.') po=i;
	st=0,ed=s.size()-1;
	while (s[st]=='0' && st!=s.size()-1 && st!=po-1) st++;
	while (s[ed]=='0' && ed!=st && po!=-1 && ed!=po) ed--;
	if (po==st) s.insert(s.begin()+st,'0'),po++,ed++;
	if (ed==po) ed--,po=-1;
	/*for (int i=st;i<=ed;i++) cout <<s[i];
	cout <<"\n";*/
	if (po==-1)
	{
		printf("%c",s[st]);
		bool fl=0;
		for (int i=st+1;i<=ed;i++) fl|=(s[i]!='0');
		if (fl) printf(".%s",s.substr(st+1,ed-st+1).c_str());
		if (st!=ed) printf("E%d",ed-st);
	}
	else
	{
		if (po==st+1 && s[st]=='0')
		{
			int t=-1;
			for (int i=st;i<=ed;i++)
			{
				if (s[i]!='0' && s[i]!='.')
				{
					t=i;
					break;
				}
			}
			if (t==-1)
			{
				cout <<"0";
				return 0;
			}
			printf("%c",s[t]);
			bool fl=0;
			for (int i=t+1;i<=ed;i++) fl|=(s[i]!='0');
			if (fl) printf(".%s",s.substr(t+1,ed-t+1).c_str());
			if (st!=ed) printf("E%d",po-t);
			return 0;
		}
		printf("%c.",s[st]);
		for (int i=st+1;i<=ed;i++)
		{
			if (i==po) continue;
			printf("%c",s[i]);
		}
		if (po!=st+1) printf("E%d",po-st-1);
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
string s;
int po=-1;
char str[100010];
int st,ed;
int main()
{
	scanf("%s",&str);
	s=str;
	for (int i=0;i<s.size();i++) if (s[i]=='.') po=i;
	st=0,ed=s.size()-1;
	while (s[st]=='0' && st!=s.size()-1 && st!=po-1) st++;
	while (s[ed]=='0' && ed!=st && po!=-1 && ed!=po) ed--;
	if (ed==po) ed--,po=-1;
	if (po==st) s.insert(s.begin()+st,'0'),po++,ed++;
	/*for (int i=st;i<=ed;i++) cout <<s[i];
	cout <<"\n";*/
	if (po==-1)
	{
		printf("%c",s[st]);
		bool fl=0;
		for (int i=st+1;i<=ed;i++) fl|=(s[i]!='0');
		if (fl) printf(".%s",s.substr(st+1,ed-st+1).c_str());
		if (st!=ed) printf("E%d",ed-st);
	}
	else
	{
		if (po==st+1 && s[st]=='0')
		{
			int t=-1;
			for (int i=st;i<=ed;i++)
			{
				if (s[i]!='0' && s[i]!='.')
				{
					t=i;
					break;
				}
			}
			if (t==-1)
			{
				cout <<"0";
				return 0;
			}
			printf("%c",s[t]);
			bool fl=0;
			for (int i=t+1;i<=ed;i++) fl|=(s[i]!='0');
			if (fl) printf(".%s",s.substr(t+1,ed-t+1).c_str());
			if (st!=ed) printf("E%d",po-t);
			return 0;
		}
		printf("%c.",s[st]);
		for (int i=st+1;i<=ed;i++)
		{
			if (i==po) continue;
			printf("%c",s[i]);
		}
		if (po!=st+1) printf("E%d",po-st+1);
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
string s;
int po=-1;
char str[100010];
int st,ed;
int main()
{
	scanf("%s",&str);
	s=str;
	for (int i=0;i<s.size();i++) if (s[i]=='.') po=i;
	st=0,ed=s.size()-1;
	while (s[st]=='0' && st!=s.size()-1 && st!=po-1) st++;
	while (s[ed]=='0' && ed!=st && po!=-1 && ed!=po) ed--;
	if (ed==po) ed--,po=-1;
	if (po==st) s.insert(s.begin()+st,'0'),po++,ed++;
	/*for (int i=st;i<=ed;i++) cout <<s[i];
	cout <<"\n";*/
	if (po==-1)
	{
		printf("%c",s[st]);
		bool fl=0;
		for (int i=st+1;i<=ed;i++) fl|=(s[i]!='0');
		if (fl) printf(".%s",s.substr(st+1,ed-st+1).c_str());
		if (st!=ed) printf("E%d",ed-st);
	}
	else
	{
		if (po==st+1 && s[st]=='0')
		{
			int t=-1;
			for (int i=st;i<=ed;i++)
			{
				if (s[i]!='0' && s[i]!='.')
				{
					t=i;
					break;
				}
			}
			if (t==-1)
			{
				cout <<"0";
				return 0;
			}
			printf("%c",s[t]);
			bool fl=0;
			for (int i=t+1;i<=ed;i++) fl|=(s[i]!='0');
			if (fl) printf(".%s",s.substr(t+1,ed-t+1).c_str());
			if (st!=ed) printf("E%d",po-t);
			return 0;
		}
		printf("%c.",s[st]);
		for (int i=st+1;i<=ed;i++)
		{
			if (i==po) continue;
			printf("%c",s[i]);
		}
		if (po!=st+1) printf("E%d",po-st-1);
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
string s;
int po=-1;
char str[1000010];
int st,ed;
int main()
{
	scanf("%s",&str);
	s=str;
	for (int i=0;i<s.size();i++) if (s[i]=='.') po=i;
	st=0,ed=s.size()-1;
	while (s[st]=='0' && st!=s.size()-1 && st!=po-1) st++;
	while (s[ed]=='0' && ed!=st && po!=-1 && ed!=po) ed--;
	if (po==st) s.insert(s.begin()+st,'0'),po++,ed++;
	if (ed==po) ed--,po=-1;
	/*for (int i=st;i<=ed;i++) cout <<s[i];
	cout <<"\n";*/
	if (po==-1)
	{
		printf("%c",s[st]);
		bool fl=0;
		for (int i=st+1;i<=ed;i++) fl|=(s[i]!='0');
		if (fl) printf(".%s",s.substr(st+1,ed-st).c_str());
		if (st!=ed) printf("E%d",ed-st);
		return 0;
	}
	else
	{
		if (po==st+1 && s[st]=='0')
		{
			int t=-1;
			for (int i=st;i<=ed;i++)
			{
				if (s[i]!='0' && s[i]!='.')
				{
					t=i;
					break;
				}
			}
			if (t==-1)
			{
				cout <<"0";
				return 0;
			}
			printf("%c",s[t]);
			bool fl=0;
			for (int i=t+1;i<=ed;i++) fl|=(s[i]!='0');
			if (fl) printf(".%s",s.substr(t+1,ed-t).c_str());
			if (st!=ed) printf("E%d",po-t);
			return 0;
		}
		printf("%c.",s[st]);
		for (int i=st+1;i<=ed;i++)
		{
			if (i==po) continue;
			printf("%c",s[i]);
		}
		if (po!=st+1) printf("E%d",po-st-1);
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
string s;
int po=-1;
char str[1000010];
int st,ed;
int main()
{
	scanf("%s",&str);
	s=str;
	for (int i=0;i<s.size();i++) if (s[i]=='.') po=i;
	st=0,ed=s.size()-1;
	while (s[st]=='0' && st!=s.size()-1 && st!=po-1) st++;
	while (s[ed]=='0' && ed!=st && po!=-1 && ed!=po) ed--;
	if (po==st) s.insert(s.begin()+st,'0'),po++,ed++;
	if (ed==po) ed--,po=-1;
	/*for (int i=st;i<=ed;i++) cout <<s[i];
	cout <<"\n";*/
	if (po==-1)
	{
		printf("%c",s[st]);
		bool fl=0;
		for (int i=st+1;i<=ed;i++) fl|=(s[i]!='0');
		int edi=ed;
		while (s[edi]=='0') edi--;
		if (fl) printf(".%s",s.substr(st+1,edi-st).c_str());
		if (st!=ed) printf("E%d",ed-st);
		return 0;
	}
	else
	{
		if (po==st+1 && s[st]=='0')
		{
			int t=-1;
			for (int i=st;i<=ed;i++)
			{
				if (s[i]!='0' && s[i]!='.')
				{
					t=i;
					break;
				}
			}
			if (t==-1)
			{
				cout <<"0";
				return 0;
			}
			printf("%c",s[t]);
			bool fl=0;
			for (int i=t+1;i<=ed;i++) fl|=(s[i]!='0');
			int edi=ed;
			while (s[edi]=='0') edi--;
			if (fl) printf(".%s",s.substr(t+1,edi-t).c_str());
			if (st!=ed) printf("E%d",po-t);
			return 0;
		}
		printf("%c.",s[st]);
		for (int i=st+1;i<=ed;i++)
		{
			if (i==po) continue;
			printf("%c",s[i]);
		}
		if (po!=st+1) printf("E%d",po-st-1);
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

const int maxn=1e6+10;

char s[maxn];

int main(){
    cin>>s;
    int st=0,ed=strlen(s)-1,mub=0;
    while(s[st]=='0'&&st<ed) st++;
    if(s[ed]=='.') ed--;
    if(s[st]=='0') cout<<0<<endl;
    else if(s[st]=='.')
         {
            while(s[ed]=='0'&&st<ed) ed--;
            if(s[ed]=='.') {cout<<'0';return 0;}
            st++;
            mub++;
            while(s[st]=='0'&&st<ed)
            {
                st++;
                mub++;
            }
            cout<<s[st];
            if(st!=ed) cout<<".";
            for(int i=st+1;i<=ed;i++)
            {
                cout<<s[i];
            }
            cout<<"E"<<-mub<<endl;
         }
    else
    {
        int ok=0;
        cout<<s[st];
        int pos=-1;
        for(int i=st+1;i<=ed;i++)
        {
            if(s[i]=='.') {pos=i;break;}
        }
        if(pos==-1) {pos=ed+1;ok=1;}
        else
		{
			while(s[ed]=='0'&&st<ed) ed--;
			if(ed<ast)
				cout<<'.';
		}
        mub=pos-st-1;
        while((s[ed]=='.'||s[ed]=='0')&&st<ed) ed--;
        if(ed>st&&ok==1) cout<<".";
       // if(mub>0) cout<<'.';
        for(int i=st+1;i<=ed;i++)
        {
            if(s[i]=='.') continue;
            cout<<s[i];
        }
        if(mub>0) cout<<"E"<<mub<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

const int maxn=1e6+10;

char s[maxn];

int main(){
    cin>>s;
    int st=0,ed=strlen(s)-1,mub=0;
    while(s[st]=='0'&&st<ed) st++;
    if(s[ed]=='.') ed--;
    if(s[st]=='0') cout<<0<<endl;
    else if(s[st]=='.')
         {
            while(s[ed]=='0'&&st<ed) ed--;
            if(s[ed]=='.') {cout<<'0';return 0;}
            st++;
            mub++;
            while(s[st]=='0'&&st<ed)
            {
                st++;
                mub++;
            }
            cout<<s[st];
            if(st!=ed) cout<<".";
            for(int i=st+1;i<=ed;i++)
            {
                cout<<s[i];
            }
            cout<<"E"<<-mub<<endl;
         }
    else
    {
        int ok=0;
        cout<<s[st];
        int pos=-1;
        for(int i=st+1;i<=ed;i++)
        {
            if(s[i]=='.') {pos=i;break;}
        }
        if(pos==-1) {pos=ed+1;ok=1;}
        else
		{
			while(s[ed]=='0'&&st<ed) ed--;
			if(s[ed]!='.')
				cout<<'.';
		}
        mub=pos-st-1;
        while(s[ed]=='0'&&st<ed) ed--;
        if(ed>st&&ok==1) cout<<".";
       // if(mub>0) cout<<'.';
        for(int i=st+1;i<=ed;i++)
        {
            if(s[i]=='.') continue;
            cout<<s[i];
        }
        if(mub>0) cout<<"E"<<mub<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

const int maxn=1e6+10;

char s[maxn];

int main(){
    cin>>s;
    int st=0,ed=strlen(s)-1,mub=0;
    while(s[st]=='0'&&st<ed) st++;
    if(s[ed]=='.') ed--;
    if(s[st]=='0') cout<<0<<endl;
    else if(s[st]=='.')
         {
            while(s[ed]=='0'&&st<ed) ed--;
            if(s[ed]=='.') {cout<<'0';return 0;}
            st++;
            mub++;
            while(s[st]=='0'&&st<ed)
            {
                st++;
                mub++;
            }
            cout<<s[st];
            if(st!=ed) cout<<".";
            for(int i=st+1;i<=ed;i++)
            {
                cout<<s[i];
            }
            cout<<"E"<<-mub<<endl;
         }
    else
    {
        int ok=0;
        cout<<s[st];
        int pos=-1;
        for(int i=st+1;i<=ed;i++)
        {
            if(s[i]=='.') {pos=i;break;}
        }
        if(pos==-1) {pos=ed+1;ok=1;}
        else cout<<'.';
        mub=pos-st-1;
        while(s[ed]=='0'&&st<ed) ed--;
        if(ed>st&&ok==1) cout<<".";
       // if(mub>0) cout<<'.';
        for(int i=st+1;i<=ed;i++)
        {
            if(s[i]=='.') continue;
            cout<<s[i];
        }
        if(mub>0) cout<<"E"<<mub<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

const int maxn=1e6+10;

char s[maxn];

int main(){
    cin>>s;
    int st=0,ed=strlen(s)-1,mub=0;
    while(s[st]=='0'&&st<ed) st++;
    if(s[ed]=='.') ed--;
    if(s[st]=='0') cout<<0<<endl;
    else if(s[st]=='.')
         {
            while(s[ed]=='0'&&st<ed) ed--;
            if(s[ed]=='.') {cout<<'0';return 0;}
            st++;
            mub++;
            while(s[st]=='0'&&st<ed)
            {
                st++;
                mub++;
            }
            cout<<s[st];
            if(st!=ed) cout<<".";
            for(int i=st+1;i<=ed;i++)
            {
                cout<<s[i];
            }
            cout<<"E"<<-mub<<endl;
         }
    else
    {
        int ok=0;
        cout<<s[st];
        int pos=-1;
        for(int i=st+1;i<=ed;i++)
        {
            if(s[i]=='.') {pos=i;break;}
        }
        if(pos==-1) {pos=ed+1;ok=1;}
        else
		{
			while((s[ed]=='.'||s[ed]=='0')&&st<ed) ed--;
			if(ed>st)
				cout<<'.';
		}
        mub=pos-st-1;
        while((s[ed]=='.'||s[ed]=='0')&&st<ed) ed--;
        if(ed>st&&ok==1) cout<<".";
       // if(mub>0) cout<<'.';
        for(int i=st+1;i<=ed;i++)
        {
            if(s[i]=='.') continue;
            cout<<s[i];
        }
        if(mub>0) cout<<"E"<<mub<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

const int maxn=1e6+10;

char s[maxn];

int main(){
    cin>>s;
    int st=0,ed=strlen(s)-1,mub=0;
    while(s[st]=='0'&&st<ed) st++;
    if(s[ed]=='.') ed--;
    if(s[st]=='0') cout<<0<<endl;
    else if(s[st]=='.')
         {
            while(s[ed]=='0'&&st<ed) ed--;
            if(s[ed]=='.') {cout<<'0';return 0;}
            st++;
            mub++;
            while(s[st]=='0'&&st<ed)
            {
                st++;
                mub++;
            }
            cout<<s[st];
            if(st!=ed) cout<<".";
            for(int i=st+1;i<=ed;i++)
            {
                cout<<s[i];
            }
            cout<<"E"<<-mub<<endl;
         }
    else
    {
        int ok=0;
        cout<<s[st];
        int pos=-1;
        for(int i=st+1;i<=ed;i++)
        {
            if(s[i]=='.') {pos=i;break;}
        }
        if(pos==-1) {pos=ed+1;ok=1;}
        else
		{
			while(s[ed]=='0'&&st<ed) ed--;
			if(s[ed]!='.')
				cout<<'.';
		}
        mub=pos-st-1;
        while((s[ed]=='.'||s[ed]=='0')&&st<ed) ed--;
        if(ed>st&&ok==1) cout<<".";
       // if(mub>0) cout<<'.';
        for(int i=st+1;i<=ed;i++)
        {
            if(s[i]=='.') continue;
            cout<<s[i];
        }
        if(mub>0) cout<<"E"<<mub<<endl;
    }
    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

string clearZeros(string x) {
    int start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    int end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    cin >> x;
    bool containsDecimal = false;
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            containsDecimal = true;
            break;
        }
    }
    if (containsDecimal == false)
        x += '.';
    x = clearZeros(x);

    int dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }

    string a = "";
    int beg = 0;
    while (x[beg] == '.' || x[beg] == '0') {
        beg++;
    }
    a += x[beg];
    a += '.';
    for (int i = beg+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }
    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);

    int index = dotPos+1;
    while (x[index] == '0') {
        index++;
    }
    int b = dotPos-index;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

string clearZeros(string x) {
    int start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    int end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    cin >> x;
    x = clearZeros(x);

    int dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }

    string a = "";
    int beg = 0;
    while (x[beg] == '.') {
        beg++;
    }
    a += x[beg];
    a += '.';
    for (int i = beg+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }

    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);
    int b = dotPos-1;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

string clearZeros(string x) {
    long long start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    long long end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    cin >> x;
    bool containsDecimal = false;
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            containsDecimal = true;
            break;
        }
    }
    if (containsDecimal == false)
        x += '.';
    x = clearZeros(x);

    long long dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }

    string a = "";
    long long nonZeroPos = 0;
    while (x[nonZeroPos] == '.' || x[nonZeroPos] == '0') {
        nonZeroPos++;
    }
    a += x[nonZeroPos];
    a += '.';
    for (int i = nonZeroPos+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }
    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);

    long long b = dotPos-nonZeroPos;
    if (b > 0)
        b--;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

string clearZeros(string x) {
    long long start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    long long end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    cin >> x;
    bool containsDecimal = false;
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            containsDecimal = true;
            break;
        }
    }
    if (containsDecimal == false)
        x += '.';
    x = clearZeros(x);

    long long dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }

    string a = "";
    long long beg = 0;
    while (x[beg] == '.' || x[beg] == '0') {
        beg++;
    }
    a += x[beg];
    a += '.';
    for (int i = beg+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }
    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);

    long long nonZeroPos = 0;
    while (x[nonZeroPos] == '0' || x[nonZeroPos] == '.') {
        nonZeroPos++;
    }
    long long b = dotPos-nonZeroPos;
    if (b > 0)
        b--;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

string clearZeros(string x) {
    int start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    int end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    cin >> x;
    bool containsDecimal = false;
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            containsDecimal = true;
            break;
        }
    }
    if (containsDecimal == false)
        x += '.';
    x = clearZeros(x);

    int dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }

    string a = "";
    int beg = 0;
    while (x[beg] == '.' || x[beg] == '0') {
        beg++;
    }
    a += x[beg];
    a += '.';
    for (int i = beg+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }
    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);

    int index = dotPos+1;
    int zeros = 0;
    while (x[index] == '0') {
        index++;
        zeros++;
    }
    int b;
    if (zeros == 0)
        b = dotPos-1;
    else
        b = dotPos-index;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

string clearZeros(string x) {
    long long start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    long long end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    ios_base::sync_with_stdio(false);
    cin >> x;
    bool containsDecimal = false;
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            containsDecimal = true;
            break;
        }
    }
    if (containsDecimal == false)
        x += '.';
    x = clearZeros(x);

    long long dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }

    string a = "";
    long long nonZeroPos = 0;
    while (x[nonZeroPos] == '.' || x[nonZeroPos] == '0') {
        nonZeroPos++;
    }
    a += x[nonZeroPos];
    a += '.';
    for (int i = nonZeroPos+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }
    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);

    long long b = dotPos-nonZeroPos;
    if (b > 0)
        b--;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

string clearZeros(string x) {
    int start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    int end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    cin >> x;
    x = clearZeros(x);

    cout << x << endl;
    int dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }

    string a = "";
    int beg = 0;
    while (x[beg] == '.') {
        beg++;
    }
    a += x[beg];
    a += '.';
    for (int i = beg+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }

    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);
    int b = dotPos-1;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

string clearZeros(string x) {
    int start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    int end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    cin >> x;
    bool containsDecimal = false;
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            containsDecimal = true;
            break;
        }
    }
    if (containsDecimal == false)
        x += '.';
    x = clearZeros(x);

    int dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }

    string a = "";
    int beg = 0;
    while (x[beg] == '.' || x[beg] == '0') {
        beg++;
    }
    a += x[beg];
    a += '.';
    for (int i = beg+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }
    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);

    int index = dotPos+1;
    int zeros = 0;
    while (x[index] == '0') {
        index++;
        zeros++;
    }
    int b = dotPos-zeros-1;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


using namespace std;

string clearZeros(string x) {
    long long start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    long long end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    cin >> x;

    long long dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }
    if (dotPos == x.length())
        x += '.';

    string a = "";
    long long nonZeroPos = 0;
    while (x[nonZeroPos] == '.' || x[nonZeroPos] == '0') {
        nonZeroPos++;
    }
    a += x[nonZeroPos];
    a += '.';
    for (int i = nonZeroPos+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }
    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);

    long long b = dotPos-nonZeroPos;
    if (b > 0)
        b--;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

string clearZeros(string x) {
    long long start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    long long end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    cin >> x;

    long long dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }
    if (dotPos == x.length())
        x += '.';

    string a = "";
    long long nonZeroPos = 0;
    while (x[nonZeroPos] == '.' || x[nonZeroPos] == '0') {
        nonZeroPos++;
    }
    a += x[nonZeroPos];
    a += '.';
    for (int i = nonZeroPos+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }
    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);

    long long b = dotPos-nonZeroPos;
    if (b > 0)
        b--;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

string clearZeros(string x) {
    long long start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    long long end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    cin >> x;
    bool containsDecimal = false;
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            containsDecimal = true;
            break;
        }
    }
    if (containsDecimal == false)
        x += '.';
    x = clearZeros(x);

    long long dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }

    string a = "";
    long long beg = 0;
    while (x[beg] == '.' || x[beg] == '0') {
        beg++;
    }
    a += x[beg];
    a += '.';
    for (int i = beg+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }
    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);

    long long index = dotPos+1;
    long long zeros = 0;
    while (x[index] == '0') {
        index++;
        zeros++;
    }
    long long b = dotPos-zeros-1;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

string clearZeros(string x) {
    int start = 0;
    while (x[start]-48 == 0) {
        x.erase(start, 1);
    }
    int end = x.length()-1;
    while (x[end]-48 == 0) {
        x.erase(end);
        end--;
    }
    return x;
}

string x;

int main() {
    cin >> x;
    bool containsDecimal = false;
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            containsDecimal = true;
            break;
        }
    }
    if (containsDecimal == false)
        x += '.';
    x = clearZeros(x);

    int dotPos = x.length();
    for (int i = 0; i < x.length(); i++) {
        if (x[i] == '.') {
            dotPos = i;
            break;
        }
    }

    string a = "";
    int beg = 0;
    while (x[beg] == '.') {
        beg++;
    }
    a += x[beg];
    a += '.';
    for (int i = beg+1; i < x.length(); i++) {
        if (x[i] == '.')
            continue;
        a += x[i];
    }

    a = clearZeros(a);
    if (a[a.length()-1] == '.')
        a.erase(a.length()-1);
    int b = dotPos-1;

    if (b == 0)
        cout << a << endl;
    else
        cout << a << "E" << b << endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+10,M=1e6+10,mod=1e9+7,inf=1e9+10;
char a[N];
char ans[N];
int main()
{
    int x,i,t;
    scanf("%s",a);
    x=strlen(a);
    for(i=0;i<x;i++)
    if(a[i]=='.')
    break;
    for(t=0;t<x;t++)
    if(a[t]!='0'&&a[t]!='.')
    break;
    int  wei=(-t+i);
    if(i>t)
    wei--;
    for(i=0;i<x;i++)
    if(a[i]!='0'&&a[i]!='.')
    break;
    int st=i;
    for(t=x-1;t>=0;t--)
    if(a[t]!='0'&&a[t]!='.')
    break;
    int en=t;

    if(st>en)
    printf("0\n");
    else
    {
        printf("%c",a[st]);
        if(en>=st+1)
        printf(".");
        for(i=st+1;i<=en;i++)
            if(a[i]!='.')
        printf("%c",a[i]);
        if(wei!=0)
        printf("E%d",wei);
        printf("\n");
    }
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+10,M=1e6+10,mod=1e9+7,inf=1e9+10;
char a[N];
char ans[N];
int main()
{
    int x,i,t;
    scanf("%s",a);
    x=strlen(a);
    for(i=0;i<x;i++)
    if(a[i]=='.')
    break;
    for(t=0;t<x;t++)
    if(a[t]!='0')
    break;
    int  wei=(-t-1+i);
    for(i=0;i<x;i++)
    if(a[i]!='0'&&a[i]!='.')
    break;
    int st=i;
    for(t=x-1;t>=0;t--)
    if(a[t]!='0'&&a[t]!='.')
    break;
    int en=t;
    if(st>en)
    printf("0\n");
    else
    {
        printf("%c",a[st]);
        if(en>=st+1&&a[st+1]!='.')
        printf(".");
        for(i=st+1;i<=en;i++)
        printf("%c",a[i]);
        if(wei!=0)
        printf("E%d",wei);
        printf("\n");
    }
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+10,M=1e6+10,mod=1e9+7,inf=1e9+10;
char a[M];
char ans[N];
int main()
{
    int x,i,t;
    scanf("%s",a);
    x=strlen(a);
    for(i=0;i<x;i++)
    if(a[i]=='.')
    break;
    for(t=0;t<x;t++)
    if(a[t]!='0'&&a[t]!='.')
    break;
    int  wei=(-t+i);
    if(i>t)
    wei--;
    for(i=0;i<x;i++)
    if(a[i]!='0'&&a[i]!='.')
    break;
    int st=i;
    for(t=x-1;t>=0;t--)
    if(a[t]!='0'&&a[t]!='.')
    break;
    int en=t;

    if(st>en)
    printf("0\n");
    else
    {
        printf("%c",a[st]);
        if(en>=st+1)
        printf(".");
        for(i=st+1;i<=en;i++)
            if(a[i]!='.')
        printf("%c",a[i]);
        if(wei!=0)
        printf("E%d",wei);
        printf("\n");
    }
	return 0;
}