/******************************************************/
/******************************************************/
/**            BISMILLAHIR RAHMANIR RAHIM            **/
/**         Al-Shahriar Tonmoy - Red_Sparkle         **/
/**  Department of Computer Science and Engineering  **/
/**               Barisal University                 **/
/**               It's time to bloom.                **/
/******************************************************/
/******************************************************/

#include<bits/stdc++.h>
using namespace std;
#define     fRead           freopen("input.txt","r",stdin)
#define     fWrite          freopen("output.txt","w",stdout)
#define     fast            ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     in1(X)          scanf("%lli",&(X))
#define     in2(X,Y)        scanf("%lli%lli",&(X),&(Y))
#define     in3(X,Y,Z)      scanf("%lli%lli%lli",&(X),&(Y),&(Z))
#define     ins(S)          scanf("%s",(S))
#define     out(X)          printf("%lli",(X))
#define     outs(S)         printf("%s",(S))
#define     printnl         printf("\n")
#define     printsp         printf(" ");
#define     End             return 0
#define     ll              long long int
#define     ul              unsigned long long int
#define     dob             double
#define     st              string
#define     pairl           pair<ll,ll>
#define     max3(a,b,c)     max(a,max(b,c))
#define     min3(a,b,c)     min(a,min(b,c))
#define     fr              first
#define     se              second
#define     T               true
#define     F               false
#define     nl              "\n"
#define     all(v)          v.begin(),v.end()
#define     mem(a,v)        memset(a,v,sizeof(a))
#define     maxi            1000000000000000014
#define     mini            -100000000000014
#define     mod             1000000007
#define     an              1000007
#define     mapi            map<ll,ll>
#define     pi              push_back
#define     po              pop_back
#define     ve              vector<ll>
#define     mp              make_pair
#define     PI              3.14159265

/*************** #Template FUNCTIONS# **************/

/// ll pc;void PrintCase(){printf("Case %lli: ",++pc);}
/// ll GCD(ll a,ll b){if(a<0) a*=-1;if(b<0) b*=-1;if(a<b)swap(a,b);if(b==1) return 1;if(!b) return a;if(!(a%b)) return b;else return GCD(b,a%b);}
/// ll LCM(ll a,ll b){ll x=GCD(a,b);return (a/x)*b;}
/// ll bigmod(ll n,ll p){if(p==0) return 1;if(p==1)return (n+mod)%mod;if(p%2)return (bigmod(n,p-1)*n+mod)%mod;else{ll x=bigmod(n,p/2);return (x*x+mod)%mod;}}
/// ll modinverse(ll n){return bigmod(n,mod-2)%mod;}
/// bool sc[an];ve pr;void sieve(){for(ll i=2;i*i<an;i++){if(!sc[i]){for(ll j=i*i;j<an;j+=i) sc[j]=1;}}pr.pi(2);for(ll i=3;i<an;i+=2) if(!sc[i]) pr.pi(i);}
/// pairl pf[an];void pri_fact(ll n){ll i,u=0;for(i=0;i<pr.size() && n!=1;i++){ll c=0;while(!(n%pr[i])){n/=pr[i];c++;} if(c){pf[u].fr=pr[i];pf[u].se=c;u++;}}if(n>1){pf[u].fr=n;pf[u].se=1;}}
/// ve de;void devisors(ll n){ll i;for(i=1;i<=sqrt(n);i++){if(!(n%i) && i!=sqrt(n)){de.pi(i);de.pi(n%i);}}if((i-1)*(i-1)==n) de.pi(i-1);sort(all(de));}

/********************** START **********************/

int main()
{

    fast;

    ll n,m,k;
    cin>>n>>m>>k;

    ll a[m],i;
    for(i=0;i<m;i++){
    	cin>>a[i];
    }

    i=0;ll p=(a[i]/k+(a[i]%k?1:0))*k,ans=0,c=0,s=0;

    while(p<=a[m-1]+k && i<m){
    	for(c=0;i<m;i++){
    		if(a[i]-s<=p){
    			c++;
    		}
    		else break;
    	}
    	s+=c;
    	if(c) ans++;
    	else p=((a[i]-s)/k+((a[i]-s)%k?1:0))*k;
    }

    cout<<ans<<endl;

    End;
}
/*****************  ALHAMDULILLAH  *****************/


/******************************************************/
/******************************************************/
/**            BISMILLAHIR RAHMANIR RAHIM            **/
/**         Al-Shahriar Tonmoy - Red_Sparkle         **/
/**  Department of Computer Science and Engineering  **/
/**               Barisal University                 **/
/**               It's time to bloom.                **/
/******************************************************/
/******************************************************/

#include<bits/stdc++.h>
using namespace std;
#define     fRead           freopen("input.txt","r",stdin)
#define     fWrite          freopen("output.txt","w",stdout)
#define     fast            ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     in1(X)          scanf("%lli",&(X))
#define     in2(X,Y)        scanf("%lli%lli",&(X),&(Y))
#define     in3(X,Y,Z)      scanf("%lli%lli%lli",&(X),&(Y),&(Z))
#define     ins(S)          scanf("%s",(S))
#define     out(X)          printf("%lli",(X))
#define     outs(S)         printf("%s",(S))
#define     printnl         printf("\n")
#define     printsp         printf(" ");
#define     End             return 0
#define     ll              long long int
#define     ul              unsigned long long int
#define     dob             double
#define     st              string
#define     pairl           pair<ll,ll>
#define     max3(a,b,c)     max(a,max(b,c))
#define     min3(a,b,c)     min(a,min(b,c))
#define     fr              first
#define     se              second
#define     T               true
#define     F               false
#define     nl              "\n"
#define     all(v)          v.begin(),v.end()
#define     mem(a,v)        memset(a,v,sizeof(a))
#define     maxi            1000000000000000014
#define     mini            -100000000000014
#define     mod             1000000007
#define     an              1000007
#define     mapi            map<ll,ll>
#define     pi              push_back
#define     po              pop_back
#define     ve              vector<ll>
#define     mp              make_pair
#define     PI              3.14159265

/*************** #Template FUNCTIONS# **************/

/// ll pc;void PrintCase(){printf("Case %lli: ",++pc);}
/// ll GCD(ll a,ll b){if(a<0) a*=-1;if(b<0) b*=-1;if(a<b)swap(a,b);if(b==1) return 1;if(!b) return a;if(!(a%b)) return b;else return GCD(b,a%b);}
/// ll LCM(ll a,ll b){ll x=GCD(a,b);return (a/x)*b;}
/// ll bigmod(ll n,ll p){if(p==0) return 1;if(p==1)return (n+mod)%mod;if(p%2)return (bigmod(n,p-1)*n+mod)%mod;else{ll x=bigmod(n,p/2);return (x*x+mod)%mod;}}
/// ll modinverse(ll n){return bigmod(n,mod-2)%mod;}
/// bool sc[an];ve pr;void sieve(){for(ll i=2;i*i<an;i++){if(!sc[i]){for(ll j=i*i;j<an;j+=i) sc[j]=1;}}pr.pi(2);for(ll i=3;i<an;i+=2) if(!sc[i]) pr.pi(i);}
/// pairl pf[an];void pri_fact(ll n){ll i,u=0;for(i=0;i<pr.size() && n!=1;i++){ll c=0;while(!(n%pr[i])){n/=pr[i];c++;} if(c){pf[u].fr=pr[i];pf[u].se=c;u++;}}if(n>1){pf[u].fr=n;pf[u].se=1;}}
/// ve de;void devisors(ll n){ll i;for(i=1;i<=sqrt(n);i++){if(!(n%i) && i!=sqrt(n)){de.pi(i);de.pi(n%i);}}if((i-1)*(i-1)==n) de.pi(i-1);sort(all(de));}

/********************** START **********************/

int main()
{

    fast;

    ll n,m,k;
    scanf("%lli %lli %lli",&n,&m,&k);

    ll a[m],i;
    for(i=0;i<m;i++){
    	scanf("%lli",&a[i]);
    }

    i=0;ll p=(a[i]/k+(a[i]%k?1:0))*k,ans=0,c=0,s=0;

    while(p<=a[m-1]+k){
    	for(c=0;i<m;i++){
    		if(a[i]-s<=p){
    			c++;
    		}
    		else break;
    	}
    	s+=c;
    	if(c) ans++;
    	else p=((a[i]-s)/k+((a[i]-s)%k?1:0))*k;
    }

    printf("%lli\n",ans);

    End;
}
/*****************  ALHAMDULILLAH  *****************/


/******************************************************/
/******************************************************/
/**            BISMILLAHIR RAHMANIR RAHIM            **/
/**         Al-Shahriar Tonmoy - Red_Sparkle         **/
/**  Department of Computer Science and Engineering  **/
/**               Barisal University                 **/
/**               It's time to bloom.                **/
/******************************************************/
/******************************************************/

#include<bits/stdc++.h>
using namespace std;
#define     fRead           freopen("input.txt","r",stdin)
#define     fWrite          freopen("output.txt","w",stdout)
#define     fast            ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     in1(X)          scanf("%lli",&(X))
#define     in2(X,Y)        scanf("%lli%lli",&(X),&(Y))
#define     in3(X,Y,Z)      scanf("%lli%lli%lli",&(X),&(Y),&(Z))
#define     ins(S)          scanf("%s",(S))
#define     out(X)          printf("%lli",(X))
#define     outs(S)         printf("%s",(S))
#define     printnl         printf("\n")
#define     printsp         printf(" ");
#define     End             return 0
#define     ll              long long int
#define     ul              unsigned long long int
#define     dob             double
#define     st              string
#define     pairl           pair<ll,ll>
#define     max3(a,b,c)     max(a,max(b,c))
#define     min3(a,b,c)     min(a,min(b,c))
#define     fr              first
#define     se              second
#define     T               true
#define     F               false
#define     nl              "\n"
#define     all(v)          v.begin(),v.end()
#define     mem(a,v)        memset(a,v,sizeof(a))
#define     maxi            1000000000000000014
#define     mini            -100000000000014
#define     mod             1000000007
#define     an              1000007
#define     mapi            map<ll,ll>
#define     pi              push_back
#define     po              pop_back
#define     ve              vector<ll>
#define     mp              make_pair
#define     PI              3.14159265

/*************** #Template FUNCTIONS# **************/

/// ll pc;void PrintCase(){printf("Case %lli: ",++pc);}
/// ll GCD(ll a,ll b){if(a<0) a*=-1;if(b<0) b*=-1;if(a<b)swap(a,b);if(b==1) return 1;if(!b) return a;if(!(a%b)) return b;else return GCD(b,a%b);}
/// ll LCM(ll a,ll b){ll x=GCD(a,b);return (a/x)*b;}
/// ll bigmod(ll n,ll p){if(p==0) return 1;if(p==1)return (n+mod)%mod;if(p%2)return (bigmod(n,p-1)*n+mod)%mod;else{ll x=bigmod(n,p/2);return (x*x+mod)%mod;}}
/// ll modinverse(ll n){return bigmod(n,mod-2)%mod;}
/// bool sc[an];ve pr;void sieve(){for(ll i=2;i*i<an;i++){if(!sc[i]){for(ll j=i*i;j<an;j+=i) sc[j]=1;}}pr.pi(2);for(ll i=3;i<an;i+=2) if(!sc[i]) pr.pi(i);}
/// pairl pf[an];void pri_fact(ll n){ll i,u=0;for(i=0;i<pr.size() && n!=1;i++){ll c=0;while(!(n%pr[i])){n/=pr[i];c++;} if(c){pf[u].fr=pr[i];pf[u].se=c;u++;}}if(n>1){pf[u].fr=n;pf[u].se=1;}}
/// ve de;void devisors(ll n){ll i;for(i=1;i<=sqrt(n);i++){if(!(n%i) && i!=sqrt(n)){de.pi(i);de.pi(n%i);}}if((i-1)*(i-1)==n) de.pi(i-1);sort(all(de));}

/********************** START **********************/

int main()
{

    fast;

    ll n,m,k;
    scanf("%lli %lli %lli",&n,&m,&k);

    ll a[m],i;
    for(i=0;i<m;i++){
    	scanf("%lli",&a[i]);
    }

    i=0;ll p=(a[i]/k+(a[i]%k?1:0))*k,ans=0,c=0,s=0;

    while(p<=a[m-1]+k && i<m){
    	for(c=0;i<m;i++){
    		if(a[i]-s<=p){
    			c++;
    		}
    		else break;
    	}
    	s+=c;
    	if(c) ans++;
    	else p=((a[i]-s)/k+((a[i]-s)%k?1:0))*k;
    }

    printf("%lli\n",ans);

    End;
}
/*****************  ALHAMDULILLAH  *****************/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll ara[100002];

int main()
{
    ll n,m,k,r,en,i,in,pg;
    double cnt;
    cin>>n>>m>>k;
    for(i=0; i<m; i++)
    {
        scanf("%lld",&ara[i]);
    }
    i=cnt=0;
    r=1;
    en=k;
    while(i<m)
    {
        pg=0;
        in=r;
        for(; i<m; i++)
        {
            if(ara[i]>en)break;
            if(ara[i]==r)r++;
            pg++;
        }
        if(pg>0)
        {
            if(in!=r)
            {
                pg-=(r-in);
                en=r+k+pg-1;
            }
            else en=k+pg+r-1;
            cnt++;
        }
        else
        {
            r=en+1;
            en=r+k-1;
        }
        if(en>n)en=n;
    }
    printf("%.0lf\n",cnt);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll ara[100002];

int main()
{
    ll n,m,k,r,en,i,in,cnt,pg;
    bool flag;
    cin>>n>>m>>k;
    for(i=0; i<m; i++)
    {
        scanf("%lld",&ara[i]);
    }
    i=cnt=0;
    r=1;
    en=k;
    while(i<m)
    {
        pg=0;
        in=r;
        for(; i<m; i++)
        {
            if(ara[i]>en)break;
            if(ara[i]==r)r++;
            pg++;
        }
        if(pg>0)
        {
            if(in!=r)
            {
                pg-=(r-in);
                en=r+k+pg-1;
            }
            else en=k+pg+r-1;
            cnt++;
        }
        else
        {
            r=en+1;
            en=r+k-1;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll ara[100002];

int main()
{
    ll n,m,k,r,en,i,in,cnt,pg;
    cin>>n>>m>>k;
    for(i=0; i<m; i++)
    {
        scanf("%lld",&ara[i]);
    }
    cnt=i=0;
    r=1;
    en=k;
    while(i<m)
    {
        pg=0;
        in=r;
        for(; i<m; i++)
        {
            if(ara[i]>en)break;
            if(ara[i]==r)r++;
            pg++;
        }
        if(pg>0)
        {
            if(in!=r)
            {
                pg-=(r-in);
                en=r+k-1+pg;
            }
            else en=en+pg;
            if(ara[i]>en)
            {
                ll dif=(ara[i]-en)/k;
                r=r+(k*dif);
                en=en+(k*dif);
                if((ara[i]-en)%k>0)
                {
                    r=en+1;
                    en=r+k-1;
                }
            }
            cnt++;
        }
        else
        {
            r=en+1;
            en=r+k-1;
            if(ara[i]>en)
            {
                ll dif=(ara[i]-en)/k;
                r=r+(k*dif);
                en=en+(k*dif);
                if((ara[i]-en)%k>0)
                {
                    r=en+1;
                    en=r+k-1;
                }
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll ara[100002];

int main()
{
    ll n,m,k,r,en,i,in,cnt,pg;
    cin>>n>>m>>k;
    for(i=0; i<m; i++)
    {
        scanf("%lld",&ara[i]);
    }
    cnt=i=0;
    r=1;
    en=k;
    while(i<m)
    {
        pg=0;
        in=r;
        for(; i<m; i++)
        {
            if(ara[i]>en)break;
            if(ara[i]==r)r++;
            pg++;
        }
        if(pg>0)
        {
            if(in!=r)
            {
                pg-=(r-in);
                en=r+k-1+pg;
            }
            else en=en+pg;
            if(ara[i]>en)
            {
                ll dif=(ara[i]-en)/k;
                r*=dif;
                en*=dif;
                if((ara[i]-en)%k>0)
                {
                    r=en+1;
                    en=r+k-1;
                }
            }
            cnt++;
        }
        else
        {
            r=en+1;
            en=r+k-1;
            if(ara[i]>en)
            {
                ll dif=(ara[i]-en)/k;
                r*=dif;
                en*=dif;
                if((ara[i]-en)%k>0)
                {
                    r=en+1;
                    en=r+k-1;
                }
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll ara[100002];

int main()
{
    ll n,m,k,r,en,i,in,cnt,pg;
    bool flag;
    cin>>n>>m>>k;
    for(i=0; i<m; i++)
    {
        scanf("%d",&ara[i]);
    }
    i=cnt=0;
    r=1;
    en=k;
    while(i<m)
    {
        pg=0;
        in=r;
        for(; i<m; i++)
        {
            if(ara[i]>en)break;
            if(ara[i]==k)r++;
            pg++;
        }
        if(pg>0)
        {
            if(in!=r)
            {
                pg-=(r-in);
                en=r+k+pg-1;
            }
            else en=k+pg+r-1;
            cnt++;
        }
        else
        {
            r=en+1;
            en=r+k-1;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll ara[100002];

int main()
{
    ll n,m,k,r,en,i,in,cnt,pg;
    bool flag;
    cin>>n>>m>>k;
    for(i=0; i<m; i++)
    {
        scanf("%lld",&ara[i]);
    }
    i=cnt=0;
    r=1;
    en=k;
    while(i<m)
    {
        pg=0;
        in=r;
        for(; i<m; i++)
        {
            if(ara[i]>en)break;
            if(ara[i]==k)r++;
            pg++;
        }
        if(pg>0)
        {
            if(in!=r)
            {
                pg-=(r-in);
                en=r+k+pg-1;
            }
            else en=k+pg+r-1;
            cnt++;
        }
        else
        {
            r=en+1;
            en=r+k-1;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
queue<ll>q;

int main()
{
    ll n,m,k,r,en,i,in,cnt,pg;
    cin>>n>>m>>k;
    for(i=0; i<m; i++)
    {
        scanf("%lld",&in);
        q.push(in);
    }
    cnt=0;
    r=1;
    en=k;
    while(!q.empty())
    {
        pg=0;
        in=r;
        while(!q.empty())
        {
            int a=q.front();
            if(a>en)break;
            if(a==r)r++;
            q.pop();
            pg++;
        }
        if(pg>0)
        {
            if(in!=r)
            {
                pg-=(r-in);
                en=r+pg;
            }
            else en=k+pg+r-1;
            cnt++;
        }
        else
        {
            r=en+1;
            en=r+k-1;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
queue<ll>q;

int main()
{
    ll n,m,k,r,en,i,in,cnt,pg;
    cin>>n>>m>>k;
    for(i=0; i<m; i++)
    {
        scanf("%lld",&in);
        q.push(in);
    }
    cnt=0;
    r=1;
    en=k;
    while(!q.empty())
    {
        pg=0;
        in=r;
        while(!q.empty())
        {
            int a=q.front();
            if(a>en)break;
            if(a==r)r++;
            q.pop();
            pg++;
        }
        if(pg>0)
        {
            if(in!=r)
            {
                pg-=(r-in);
                en=r+k-1+pg;
            }
            else en=en+pg;
            cnt++;
        }
        else
        {
            r=en+1;
            en=r+k-1;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
queue<ll>q;

int main()
{
    ll n,m,k,r,en,i,in,cnt,pg;
    cin>>n>>m>>k;
    for(i=0; i<m; i++)
    {
        scanf("%lld",&in);
        q.push(in);
    }
    cnt=0;
    r=1;
    en=k;
    while(!q.empty())
    {
        pg=0;
        in=r;
        while(!q.empty())
        {
            int a=q.front();
            if(a>en)break;
            if(a==r)r++;
            q.pop();
            pg++;
        }
        if(pg>0)
        {
            if(in!=r)
            {
                pg-=(r-in);
                en=r+k+pg-1;
            }
            else en=k+pg+r-1;
            cnt++;
        }
        else
        {
            r=en+1;
            en=r+k-1;
        }
        if(en>n)en=n;
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll ara[100002];

int main()
{
    ll n,m,k,r,en,i,in,cnt,pg;
    cin>>n>>m>>k;
    for(i=0; i<m; i++)
    {
        scanf("%lld",&ara[i]);
    }
    cnt=i=0;
    r=1;
    en=k;
    while(i<m)
    {
        pg=0;
        in=r;
        for(; i<m; i++)
        {
            if(ara[i]>en)break;
            if(ara[i]==r)r++;
            pg++;
        }
        if(pg>0)
        {
            if(in!=r)
            {
                pg-=(r-in);
                en=r+k-1+pg;
            }
            else en=en+pg;
            cnt++;
        }
        else
        {
            r=en+1;
            en=r+k-1;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

typedef     long long int    ll;
typedef     long double      ld;
typedef     pair<ll,ll>      pll;
#define     FOR(i,a,b)       for(ll i=a;i<b;i++)
#define     FORE(i,a,b)      for(int i=a;i<=b;i++)
#define     FORD(i,b,a)      for(int i=b;i>a;i--)
#define     FORDE(i,b,a)     for(ll i=b;i>=a;i--)
#define     debug(x)         cout<< '>'<<#x<<" : "<<x<<"\n";
#define     debug2(x,y)      cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define     debug3(x,y,z)    cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define     umap             unordered_map
#define     uset             unordered_set
#define     lb               lower_bound
#define     ub               upper_bound
#define     mp               make_pair
#define     in               insert
#define     s                second
#define     f                first
#define     nn               cout<<"\n"
#define     pb               push_back
#define     testcase         int t;cin>>t;while(t--)
#define     gcd(a,b)         __gcd(a,b)
#define     maxv             INT_MAX
#define     minv             INT_MIN
#define     MOD              1000000007
#define     FastIO           ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     here             cout<<"I'm here\n";
#define     flush            fflush(stdout);
#define     mem(a)           memset((a),0,sizeof(a));
#define     ordered_set      tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
template<class T> void disparray(T *v, int n){for(int i=0;i<n;i++) cout<<v[i]<<" "; nn;}
template<class T> int sizeofarr(T *v){return sizeof(v)/sizeof(T);}

signed main(int argc, char** argv)
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> arr(m);
    FOR(i,0,m){
        cin >> arr[i];
    }
    sort(arr.begin(),arr.end());
    ll op = 0;
    ll discarded = 0;
    for(ll i = k; i < n+k;){
        ll currDiscarded = 1;
        while(currDiscarded > 0){
            // here;
            currDiscarded = 0;
            // debug2(i,discarded);
            auto itr = ub(arr.begin(),arr.end(),i+discarded);
            // debug(*itr);
            if(itr == arr.end()){
                currDiscarded = arr.size() - discarded;
            }else{
                // debug2(itr-arr.begin())
                currDiscarded = (itr - arr.begin()) - discarded;
                // debug(currDiscarded);
            }
            if(currDiscarded > 0){
                op++;
                discarded += currDiscarded;
            }else{
                break;
            }
        }
        // debug(discarded);

        // i+=k;
        if(discarded < m)
        i = ((1ll * arr[discarded]-discarded)/5 * 5) + 5;
        else break;
    }
    cout << op <<"\n";

    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

typedef     long long int    ll;
typedef     long double      ld;
typedef     pair<ll,ll>      pll;
#define     FOR(i,a,b)       for(ll i=a;i<b;i++)
#define     FORE(i,a,b)      for(int i=a;i<=b;i++)
#define     FORD(i,b,a)      for(int i=b;i>a;i--)
#define     FORDE(i,b,a)     for(ll i=b;i>=a;i--)
#define     debug(x)         cout<< '>'<<#x<<" : "<<x<<"\n";
#define     debug2(x,y)      cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define     debug3(x,y,z)    cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define     umap             unordered_map
#define     uset             unordered_set
#define     lb               lower_bound
#define     ub               upper_bound
#define     mp               make_pair
#define     in               insert
#define     s                second
#define     f                first
#define     nn               cout<<"\n"
#define     pb               push_back
#define     testcase         int t;cin>>t;while(t--)
#define     gcd(a,b)         __gcd(a,b)
#define     maxv             INT_MAX
#define     minv             INT_MIN
#define     MOD              1000000007
#define     FastIO           ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     here             cout<<"I'm here\n";
#define     flush            fflush(stdout);
#define     mem(a)           memset((a),0,sizeof(a));
#define     ordered_set      tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
template<class T> void disparray(T *v, int n){for(int i=0;i<n;i++) cout<<v[i]<<" "; nn;}
template<class T> int sizeofarr(T *v){return sizeof(v)/sizeof(T);}

signed main(int argc, char** argv)
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> arr(m);
    FOR(i,0,m){
        cin >> arr[i];
    }
    ll op = 0;
    ll discarded = 0;
    for(ll i = (((1ll * (arr[discarded]-discarded))/k) * k); i <= n;){
        ll currDiscarded = 1;
        while(currDiscarded > 0){
            currDiscarded = 0;
            auto itr = ub(arr.begin(),arr.end(),i+discarded);
            if(itr == arr.end()){
                currDiscarded = arr.size() - discarded;
            }else{
                currDiscarded = (itr - arr.begin()) - discarded;
            }
            if(currDiscarded > 0){
                op++;
                discarded += currDiscarded;
            }else{
                break;
            }

        }
        if(discarded < m)
        i = (((1ll * (arr[discarded]-discarded))/k) * k) + (1ll*k);
        else break;
    }
    cout << op <<"\n";

    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

typedef     long long int    ll;
typedef     long double      ld;
typedef     pair<ll,ll>      pll;
#define     FOR(i,a,b)       for(ll i=a;i<b;i++)
#define     FORE(i,a,b)      for(int i=a;i<=b;i++)
#define     FORD(i,b,a)      for(int i=b;i>a;i--)
#define     FORDE(i,b,a)     for(ll i=b;i>=a;i--)
#define     debug(x)         cout<< '>'<<#x<<" : "<<x<<"\n";
#define     debug2(x,y)      cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define     debug3(x,y,z)    cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define     umap             unordered_map
#define     uset             unordered_set
#define     lb               lower_bound
#define     ub               upper_bound
#define     mp               make_pair
#define     in               insert
#define     s                second
#define     f                first
#define     nn               cout<<"\n"
#define     pb               push_back
#define     testcase         int t;cin>>t;while(t--)
#define     gcd(a,b)         __gcd(a,b)
#define     maxv             INT_MAX
#define     minv             INT_MIN
#define     MOD              1000000007
#define     FastIO           ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     here             cout<<"I'm here\n";
#define     flush            fflush(stdout);
#define     mem(a)           memset((a),0,sizeof(a));
#define     ordered_set      tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
template<class T> void disparray(T *v, int n){for(int i=0;i<n;i++) cout<<v[i]<<" "; nn;}
template<class T> int sizeofarr(T *v){return sizeof(v)/sizeof(T);}

signed main(int argc, char** argv)
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> arr(m);
    FOR(i,0,m){
        cin >> arr[i];
    }
    ll op = 0;
    ll discarded = 0;
    for(ll i = ((1ll * arr[discarded]-discarded)/k * k) + k; i <= n + k;){
        ll currDiscarded = 1;
        while(currDiscarded > 0){
            currDiscarded = 0;
            auto itr = ub(arr.begin(),arr.end(),i+discarded);
            if(itr == arr.end()){
                currDiscarded = arr.size() - discarded;
            }else{
                currDiscarded = (itr - arr.begin()) - discarded;
            }
            if(currDiscarded > 0){
                op++;
                discarded += currDiscarded;
            }else{
                break;
            }

        }
        if(discarded < m)
        i = ((1ll * arr[discarded]-discarded)/k * k) + k;
        else break;
    }
    cout << op <<"\n";

    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

typedef     long long int    ll;
typedef     long double      ld;
typedef     pair<ll,ll>      pll;
#define     FOR(i,a,b)       for(ll i=a;i<b;i++)
#define     FORE(i,a,b)      for(int i=a;i<=b;i++)
#define     FORD(i,b,a)      for(int i=b;i>a;i--)
#define     FORDE(i,b,a)     for(ll i=b;i>=a;i--)
#define     debug(x)         cout<< '>'<<#x<<" : "<<x<<"\n";
#define     debug2(x,y)      cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define     debug3(x,y,z)    cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define     umap             unordered_map
#define     uset             unordered_set
#define     lb               lower_bound
#define     ub               upper_bound
#define     mp               make_pair
#define     in               insert
#define     s                second
#define     f                first
#define     nn               cout<<"\n"
#define     pb               push_back
#define     testcase         int t;cin>>t;while(t--)
#define     gcd(a,b)         __gcd(a,b)
#define     maxv             INT_MAX
#define     minv             INT_MIN
#define     MOD              1000000007
#define     FastIO           ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     here             cout<<"I'm here\n";
#define     flush            fflush(stdout);
#define     mem(a)           memset((a),0,sizeof(a));
#define     ordered_set      tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
template<class T> void disparray(T *v, int n){for(int i=0;i<n;i++) cout<<v[i]<<" "; nn;}
template<class T> int sizeofarr(T *v){return sizeof(v)/sizeof(T);}

signed main(int argc, char** argv)
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> arr(m);
    FOR(i,0,m){
        cin >> arr[i];
    }
    ll op = 0;
    ll discarded = 0;
    for(ll i = (((1ll * (arr[discarded]-discarded))/k) * k) == n ? n :(((1ll * (arr[discarded]-discarded))/k) * k) + k; i <= n+k;){
        ll currDiscarded = 1;
        while(currDiscarded > 0){
            currDiscarded = 0;
            auto itr = ub(arr.begin(),arr.end(),i+discarded);
            if(itr == arr.end()){
                currDiscarded = arr.size() - discarded;
            }else{
                currDiscarded = (itr - arr.begin()) - discarded;
            }
            if(currDiscarded > 0){
                op++;
                discarded += currDiscarded;
            }else{
                break;
            }

        }
        if(discarded < m)
        i = (((1ll * (arr[discarded]-discarded))/k) * k) + (1ll*k);
        else break;
    }
    cout << op <<"\n";

    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

typedef     long long int    ll;
typedef     long double      ld;
typedef     pair<ll,ll>      pll;
#define     FOR(i,a,b)       for(ll i=a;i<b;i++)
#define     FORE(i,a,b)      for(int i=a;i<=b;i++)
#define     FORD(i,b,a)      for(int i=b;i>a;i--)
#define     FORDE(i,b,a)     for(ll i=b;i>=a;i--)
#define     debug(x)         cout<< '>'<<#x<<" : "<<x<<"\n";
#define     debug2(x,y)      cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define     debug3(x,y,z)    cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define     umap             unordered_map
#define     uset             unordered_set
#define     lb               lower_bound
#define     ub               upper_bound
#define     mp               make_pair
#define     in               insert
#define     s                second
#define     f                first
#define     nn               cout<<"\n"
#define     pb               push_back
#define     testcase         int t;cin>>t;while(t--)
#define     gcd(a,b)         __gcd(a,b)
#define     maxv             INT_MAX
#define     minv             INT_MIN
#define     MOD              1000000007
#define     FastIO           ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     here             cout<<"I'm here\n";
#define     flush            fflush(stdout);
#define     mem(a)           memset((a),0,sizeof(a));
#define     ordered_set      tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
template<class T> void disparray(T *v, int n){for(int i=0;i<n;i++) cout<<v[i]<<" "; nn;}
template<class T> int sizeofarr(T *v){return sizeof(v)/sizeof(T);}

signed main(int argc, char** argv)
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> arr(m);
    FOR(i,0,m){
        cin >> arr[i];
    }
    sort(arr.begin(),arr.end());
    ll op = 0;
    ll discarded = 0;
    for(ll i = k; i <= n;){
        ll currDiscarded = 1;
        while(currDiscarded > 0){
            currDiscarded = 0;
            auto itr = ub(arr.begin(),arr.end(),i+discarded);
            if(itr == arr.end()){
                currDiscarded = arr.size() - discarded;
            }else{
                currDiscarded = (itr - arr.begin()) - discarded;
            }
            if(currDiscarded > 0){
                op++;
                discarded += currDiscarded;
            }else{
                break;
            }

        }
        if(discarded < m)
        i = ((1ll * arr[discarded]-discarded)/k * k) + k;
        else break;
    }
    cout << op <<"\n";

    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

typedef     long long int    ll;
typedef     long double      ld;
typedef     pair<ll,ll>      pll;
#define     FOR(i,a,b)       for(ll i=a;i<b;i++)
#define     FORE(i,a,b)      for(int i=a;i<=b;i++)
#define     FORD(i,b,a)      for(int i=b;i>a;i--)
#define     FORDE(i,b,a)     for(ll i=b;i>=a;i--)
#define     debug(x)         cout<< '>'<<#x<<" : "<<x<<"\n";
#define     debug2(x,y)      cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define     debug3(x,y,z)    cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define     umap             unordered_map
#define     uset             unordered_set
#define     lb               lower_bound
#define     ub               upper_bound
#define     mp               make_pair
#define     in               insert
#define     s                second
#define     f                first
#define     nn               cout<<"\n"
#define     pb               push_back
#define     testcase         int t;cin>>t;while(t--)
#define     gcd(a,b)         __gcd(a,b)
#define     maxv             INT_MAX
#define     minv             INT_MIN
#define     MOD              1000000007
#define     FastIO           ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     here             cout<<"I'm here\n";
#define     flush            fflush(stdout);
#define     mem(a)           memset((a),0,sizeof(a));
#define     ordered_set      tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
template<class T> void disparray(T *v, int n){for(int i=0;i<n;i++) cout<<v[i]<<" "; nn;}
template<class T> int sizeofarr(T *v){return sizeof(v)/sizeof(T);}

signed main(int argc, char** argv)
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> arr(m);
    FOR(i,0,m){
        cin >> arr[i];
    }
    sort(arr.begin(),arr.end());
    ll op = 0;
    ll discarded = 0;
    for(ll i = k; i < n+k;){
        ll currDiscarded = 1;
        while(currDiscarded > 0){
            // here;
            currDiscarded = 0;
            // debug2(i,discarded);
            auto itr = ub(arr.begin(),arr.end(),i+discarded);
            // debug(*itr);
            if(itr == arr.end()){
                currDiscarded = arr.size() - discarded;
            }else{
                // debug2(itr-arr.begin())
                currDiscarded = (itr - arr.begin()) - discarded;
                // debug(currDiscarded);
            }
            if(currDiscarded > 0){
                op++;
                discarded += currDiscarded;
            }else{
                break;
            }
        }
        // debug(discarded);

        // i+=k;
        if(discarded < m)
        i = ((1ll * arr[discarded]-discarded)/k * k) + k;
        else break;
    }
    cout << op <<"\n";

    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

typedef     long long int    ll;
typedef     long double      ld;
typedef     pair<ll,ll>      pll;
#define     FOR(i,a,b)       for(ll i=a;i<b;i++)
#define     FORE(i,a,b)      for(int i=a;i<=b;i++)
#define     FORD(i,b,a)      for(int i=b;i>a;i--)
#define     FORDE(i,b,a)     for(ll i=b;i>=a;i--)
#define     debug(x)         cout<< '>'<<#x<<" : "<<x<<"\n";
#define     debug2(x,y)      cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define     debug3(x,y,z)    cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define     umap             unordered_map
#define     uset             unordered_set
#define     lb               lower_bound
#define     ub               upper_bound
#define     mp               make_pair
#define     in               insert
#define     s                second
#define     f                first
#define     nn               cout<<"\n"
#define     pb               push_back
#define     testcase         int t;cin>>t;while(t--)
#define     gcd(a,b)         __gcd(a,b)
#define     maxv             INT_MAX
#define     minv             INT_MIN
#define     MOD              1000000007
#define     FastIO           ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     here             cout<<"I'm here\n";
#define     flush            fflush(stdout);
#define     mem(a)           memset((a),0,sizeof(a));
#define     ordered_set      tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
template<class T> void disparray(T *v, int n){for(int i=0;i<n;i++) cout<<v[i]<<" "; nn;}
template<class T> int sizeofarr(T *v){return sizeof(v)/sizeof(T);}

signed main(int argc, char** argv)
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> arr(m);
    FOR(i,0,m){
        cin >> arr[i];
    }
    ll op = 0;
    ll discarded = 0;
    for(ll i = (((1ll * (arr[discarded]-discarded))/k) * k); i <= n + k;){
        ll currDiscarded = 1;
        while(currDiscarded > 0){
            currDiscarded = 0;
            auto itr = ub(arr.begin(),arr.end(),i+discarded);
            if(itr == arr.end()){
                currDiscarded = arr.size() - discarded;
            }else{
                currDiscarded = (itr - arr.begin()) - discarded;
            }
            if(currDiscarded > 0){
                op++;
                discarded += currDiscarded;
            }else{
                break;
            }

        }
        if(discarded < m)
        i = (((1ll * (arr[discarded]-discarded))/k) * k) + (1ll*k);
        else break;
    }
    cout << op <<"\n";

    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

typedef     long long int    ll;
typedef     long double      ld;
typedef     pair<ll,ll>      pll;
#define     FOR(i,a,b)       for(ll i=a;i<b;i++)
#define     FORE(i,a,b)      for(int i=a;i<=b;i++)
#define     FORD(i,b,a)      for(int i=b;i>a;i--)
#define     FORDE(i,b,a)     for(ll i=b;i>=a;i--)
#define     debug(x)         cout<< '>'<<#x<<" : "<<x<<"\n";
#define     debug2(x,y)      cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define     debug3(x,y,z)    cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define     umap             unordered_map
#define     uset             unordered_set
#define     lb               lower_bound
#define     ub               upper_bound
#define     mp               make_pair
#define     in               insert
#define     s                second
#define     f                first
#define     nn               cout<<"\n"
#define     pb               push_back
#define     testcase         int t;cin>>t;while(t--)
#define     gcd(a,b)         __gcd(a,b)
#define     maxv             INT_MAX
#define     minv             INT_MIN
#define     MOD              1000000007
#define     FastIO           ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     here             cout<<"I'm here\n";
#define     flush            fflush(stdout);
#define     mem(a)           memset((a),0,sizeof(a));
#define     ordered_set      tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
template<class T> void disparray(T *v, int n){for(int i=0;i<n;i++) cout<<v[i]<<" "; nn;}
template<class T> int sizeofarr(T *v){return sizeof(v)/sizeof(T);}

signed main(int argc, char** argv)
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> arr(m);
    FOR(i,0,m){
        cin >> arr[i];
    }
    ll op = 0;
    ll discarded = 0;
    for(ll i = ((1ll * arr[discarded]-discarded)/k * k); i <= n;){
        ll currDiscarded = 1;
        while(currDiscarded > 0){
            currDiscarded = 0;
            auto itr = ub(arr.begin(),arr.end(),i+discarded);
            if(itr == arr.end()){
                currDiscarded = arr.size() - discarded;
            }else{
                currDiscarded = (itr - arr.begin()) - discarded;
            }
            if(currDiscarded > 0){
                op++;
                discarded += currDiscarded;
            }else{
                break;
            }

        }
        if(discarded < m)
        i = ((1ll * arr[discarded]-discarded)/k * k) + k;
        else break;
    }
    cout << op <<"\n";

    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

typedef     long long int    ll;
typedef     long double      ld;
typedef     pair<ll,ll>      pll;
#define     FOR(i,a,b)       for(ll i=a;i<b;i++)
#define     FORE(i,a,b)      for(int i=a;i<=b;i++)
#define     FORD(i,b,a)      for(int i=b;i>a;i--)
#define     FORDE(i,b,a)     for(ll i=b;i>=a;i--)
#define     debug(x)         cout<< '>'<<#x<<" : "<<x<<"\n";
#define     debug2(x,y)      cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define     debug3(x,y,z)    cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define     umap             unordered_map
#define     uset             unordered_set
#define     lb               lower_bound
#define     ub               upper_bound
#define     mp               make_pair
#define     in               insert
#define     s                second
#define     f                first
#define     nn               cout<<"\n"
#define     pb               push_back
#define     testcase         int t;cin>>t;while(t--)
#define     gcd(a,b)         __gcd(a,b)
#define     maxv             INT_MAX
#define     minv             INT_MIN
#define     MOD              1000000007
#define     FastIO           ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     here             cout<<"I'm here\n";
#define     flush            fflush(stdout);
#define     mem(a)           memset((a),0,sizeof(a));
#define     ordered_set      tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
template<class T> void disparray(T *v, int n){for(int i=0;i<n;i++) cout<<v[i]<<" "; nn;}
template<class T> int sizeofarr(T *v){return sizeof(v)/sizeof(T);}

signed main(int argc, char** argv)
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> arr(m);
    FOR(i,0,m){
        cin >> arr[i];
    }
    ll op = 0;
    ll discarded = 0;
    ll i = (arr[discarded]-discarded)%k == 0 ? (((1ll * (arr[discarded]-discarded))/k) * k) : (((1ll * (arr[discarded]-discarded))/k) * k) + k;
    for(; i <= n + k;){
        ll currDiscarded = 1;
        while(currDiscarded > 0){
            currDiscarded = 0;
            auto itr = ub(arr.begin(),arr.end(),i+discarded);
            if(itr == arr.end()){
                currDiscarded = arr.size() - discarded;
            }else{
                currDiscarded = (itr - arr.begin()) - discarded;
            }
            if(currDiscarded > 0){
                op++;
                discarded += currDiscarded;
            }else{
                break;
            }

        }
        if(discarded < m)
        i = (arr[discarded]-discarded)%k == 0 ? (((1ll * (arr[discarded]-discarded))/k) * k) : (((1ll * (arr[discarded]-discarded))/k) * k) + k;
        else break;
    }
    cout << op <<"\n";

    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

typedef     long long int    ll;
typedef     long double      ld;
typedef     pair<ll,ll>      pll;
#define     FOR(i,a,b)       for(ll i=a;i<b;i++)
#define     FORE(i,a,b)      for(int i=a;i<=b;i++)
#define     FORD(i,b,a)      for(int i=b;i>a;i--)
#define     FORDE(i,b,a)     for(ll i=b;i>=a;i--)
#define     debug(x)         cout<< '>'<<#x<<" : "<<x<<"\n";
#define     debug2(x,y)      cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define     debug3(x,y,z)    cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define     umap             unordered_map
#define     uset             unordered_set
#define     lb               lower_bound
#define     ub               upper_bound
#define     mp               make_pair
#define     in               insert
#define     s                second
#define     f                first
#define     nn               cout<<"\n"
#define     pb               push_back
#define     testcase         int t;cin>>t;while(t--)
#define     gcd(a,b)         __gcd(a,b)
#define     maxv             INT_MAX
#define     minv             INT_MIN
#define     MOD              1000000007
#define     FastIO           ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     here             cout<<"I'm here\n";
#define     flush            fflush(stdout);
#define     mem(a)           memset((a),0,sizeof(a));
#define     ordered_set      tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
template<class T> void disparray(T *v, int n){for(int i=0;i<n;i++) cout<<v[i]<<" "; nn;}
template<class T> int sizeofarr(T *v){return sizeof(v)/sizeof(T);}

signed main(int argc, char** argv)
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> arr(m);
    FOR(i,0,m){
        cin >> arr[i];
    }
    ll op = 0;
    ll discarded = 0;
    for(ll i = (((1ll * (arr[discarded]-discarded))/k) * k); i <= n;){
        ll currDiscarded = 1;
        while(currDiscarded > 0){
            currDiscarded = 0;
            auto itr = lb(arr.begin(),arr.end(),i+discarded);
            if(itr == arr.end()){
                currDiscarded = arr.size() - discarded;
            }else{
                currDiscarded = (itr - arr.begin()) - discarded;
            }
            if(currDiscarded > 0){
                op++;
                discarded += currDiscarded;
            }else{
                break;
            }

        }
        if(discarded < m)
        i = (((1ll * (arr[discarded]-discarded))/k) * k) + (1ll*k);
        else break;
    }
    cout << op <<"\n";

    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

typedef     long long int    ll;
typedef     long double      ld;
typedef     pair<ll,ll>      pll;
#define     FOR(i,a,b)       for(ll i=a;i<b;i++)
#define     FORE(i,a,b)      for(int i=a;i<=b;i++)
#define     FORD(i,b,a)      for(int i=b;i>a;i--)
#define     FORDE(i,b,a)     for(ll i=b;i>=a;i--)
#define     debug(x)         cout<< '>'<<#x<<" : "<<x<<"\n";
#define     debug2(x,y)      cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define     debug3(x,y,z)    cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define     umap             unordered_map
#define     uset             unordered_set
#define     lb               lower_bound
#define     ub               upper_bound
#define     mp               make_pair
#define     in               insert
#define     s                second
#define     f                first
#define     nn               cout<<"\n"
#define     pb               push_back
#define     testcase         int t;cin>>t;while(t--)
#define     gcd(a,b)         __gcd(a,b)
#define     maxv             INT_MAX
#define     minv             INT_MIN
#define     MOD              1000000007
#define     FastIO           ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     here             cout<<"I'm here\n";
#define     flush            fflush(stdout);
#define     mem(a)           memset((a),0,sizeof(a));
#define     ordered_set      tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<class T> void dispvector(vector<T> v){for(int i=0;i<v.size();i++) cout<<v[i]<<" "; nn;}
template<class T> void disparray(T *v, int n){for(int i=0;i<n;i++) cout<<v[i]<<" "; nn;}
template<class T> int sizeofarr(T *v){return sizeof(v)/sizeof(T);}

signed main(int argc, char** argv)
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> arr(m);
    FOR(i,0,m){
        cin >> arr[i];
    }
    sort(arr.begin(),arr.end());
    ll op = 0;
    ll discarded = 0;
    for(ll i = k; i < n;){
        ll currDiscarded = 1;
        while(currDiscarded > 0){
            currDiscarded = 0;
            auto itr = ub(arr.begin(),arr.end(),i+discarded);
            if(itr == arr.end()){
                currDiscarded = arr.size() - discarded;
            }else{
                currDiscarded = (itr - arr.begin()) - discarded;
            }
            if(currDiscarded > 0){
                op++;
                discarded += currDiscarded;
            }else{
                break;
            }
        }
        if(discarded < m)
        i = ((1ll * arr[discarded]-discarded)/k * k) + k;
        else break;
    }
    cout << op <<"\n";

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi              first
#define se              second
#define ll              long long
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pll             pair<ll,ll>
#define vll             vector<ll>
#define mll             map<ll,ll>
#define setbits(x)      __builtin_popcountll(x)
#define md              (ll)1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define f(i,j,n)        for(ll i=j;i<n;i++)
#define r(i,j,n)        for(ll i=n-1;i>=j;i--)
void solve()
{
    ll n,m,k,ans=0,sp=0,l=0,j=0; cin>>n>>m>>k;
    vll p(m); for(int i=0;i<n;i++)    cin>>p[i];
    while(l<m)
    {
        sp=(p[l]-l)/k;
        if((p[l]-l)%k==0) sp--,j=0,l++;
        else
        j=k-(p[l]-l)%k,
        l+=upper_bound(p.begin(),p.end(),p[l]+j)-p.begin()-l+1;
        //cout<<sp<<" "<<j<<" "<<l<<"-> ";
        //cout<<l<<"\n";
        ans++;
    }
    cout<<ans<<"\n";
}
int32_t main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("inpput.txt", "r", stdin); //freopen("op.txt", "w", stdout);
    #endif
    ll test_cases=1; //cin>>test_cases;
    for(ll t=1;t<=test_cases;t++)
        solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi              first
#define se              second
#define ll              long long
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pll             pair<ll,ll>
#define vll             vector<ll>
#define mll             map<ll,ll>
#define setbits(x)      __builtin_popcountll(x)
#define md              (ll)1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define f(i,j,n)        for(ll i=j;i<n;i++)
#define r(i,j,n)        for(ll i=n-1;i>=j;i--)
void solve()
{
    ll n,m,k,ans=0,sp=0,l=0,j=0; cin>>n>>m>>k;
    vll p(m); for(int i=0;i<n;i++)    cin>>p[i];
    auto temp=upper_bound(p.begin(),p.end(),p[0]);
    while(l<m)
    {
        sp=(p[l]-l)/k;
        if((p[l]-l)%k==0) sp--,j=0,l++,temp++;
        else
        {
        j=k-(p[l]-l)%k;
        auto temp1=upper_bound(p.begin(),p.end(),p[l]+j);
        l+=temp1-temp+1;
        temp=temp1;
        }
        //cout<<sp<<" "<<j<<" "<<l<<"-> ";
        //cout<<l<<"\n";
        ans++;
    }
    cout<<ans<<"\n";
}
int32_t main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("inpput.txt", "r", stdin); //freopen("op.txt", "w", stdout);
    #endif
    ll test_cases=1; //cin>>test_cases;
    for(ll t=1;t<=test_cases;t++)
        solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi              first
#define se              second
#define ll              long long
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pll             pair<ll,ll>
#define vll             vector<ll>
#define mll             map<ll,ll>
#define setbits(x)      __builtin_popcountll(x)
#define md              (ll)1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define f(i,j,n)        for(ll i=j;i<n;i++)
#define r(i,j,n)        for(ll i=n-1;i>=j;i--)
void solve()
{
    ll n,m,k,ans=0,sp=0,l=0,j=0; cin>>n>>m>>k;
    vll p(m); for(int i=0;i<n;i++)    cin>>p[i];
    while(l<m && ans<m)
    {
        sp=(p[l]-l)/k;
        if((p[l]-l)%k==0) sp--,j=0;
        else
        j=k-(p[l]-l)%k;
        //cout<<sp<<" "<<j<<" "<<l<<"-> ";
        l+=upper_bound(p.begin(),p.end(),p[l]+j)-upper_bound(p.begin(),p.end(),p[l])+1;
        //cout<<l<<"\n";
        ans++;
    }
    cout<<ans<<"\n";
}
int32_t main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("inpput.txt", "r", stdin); //freopen("op.txt", "w", stdout);
    #endif
    ll test_cases=1; //cin>>test_cases;
    for(ll t=1;t<=test_cases;t++)
        solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi              first
#define se              second
#define ll              long long
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pll             pair<ll,ll>
#define vll             vector<ll>
#define mll             map<ll,ll>
#define setbits(x)      __builtin_popcountll(x)
#define md              (ll)1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define f(i,j,n)        for(ll i=j;i<n;i++)
#define r(i,j,n)        for(ll i=n-1;i>=j;i--)
void solve()
{
    ll n,m,k,ans=0,sp=0,l=0,j=0; cin>>n>>m>>k;
    vll p(m); for(int i=0;i<n;i++)    cin>>p[i];
    while(l<m)
    {
        sp=(p[l]-l)/k;
        if((p[l]-l)%k==0) sp--,j=0,l++;
        else
        {
            j=k-(p[l]-l)%k;
            ll x = p[l]+j;
            while(p[l]<= x && l<m)  l++;
            //l+=upper_bound(p.begin(),p.end(),p[l]+j)-upper_bound(p.begin(),p.end(),p[l])+1;

        }
        //cout<<sp<<" "<<j<<" "<<l<<"-> ";
        //cout<<l<<"\n";
        ans++;
    }
    cout<<ans<<"\n";
}
int32_t main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("inpput.txt", "r", stdin); //freopen("op.txt", "w", stdout);
    #endif
    ll test_cases=1; //cin>>test_cases;
    for(ll t=1;t<=test_cases;t++)
        solve();
    //cerr<<"Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi              first
#define se              second
#define ll              long long
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pll             pair<ll,ll>
#define vll             vector<ll>
#define mll             map<ll,ll>
#define setbits(x)      __builtin_popcountll(x)
#define md              (ll)1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define f(i,j,n)        for(ll i=j;i<n;i++)
#define r(i,j,n)        for(ll i=n-1;i>=j;i--)
void solve()
{
    ll n,m,k,ans=0,sp=0,l=0,j=0; cin>>n>>m>>k;
    vll p(m); for(int i=0;i<n;i++)    cin>>p[i];
    while(l<m)
    {
        sp=(p[l]-l)/k;
        if((p[l]-l)%k==0) sp--,j=0,l++;
        else
        {
            j=k-(p[l]-l)%k;
            ll x = p[l]+j;
            while(p[l]<= x)  l++;
            //l+=upper_bound(p.begin(),p.end(),p[l]+j)-upper_bound(p.begin(),p.end(),p[l])+1;

        }
        //cout<<sp<<" "<<j<<" "<<l<<"-> ";
        //cout<<l<<"\n";
        ans++;
    }
    cout<<ans<<"\n";
}
int32_t main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("inpput.txt", "r", stdin); //freopen("op.txt", "w", stdout);
    #endif
    ll test_cases=1; //cin>>test_cases;
    for(ll t=1;t<=test_cases;t++)
        solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi              first
#define se              second
#define ll              long long
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pll             pair<ll,ll>
#define vll             vector<ll>
#define mll             map<ll,ll>
#define setbits(x)      __builtin_popcountll(x)
#define md              (ll)1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define f(i,j,n)        for(ll i=j;i<n;i++)
#define r(i,j,n)        for(ll i=n-1;i>=j;i--)
void solve()
{
    ll n,m,k,ans=0,sp=0,l=0,j=0; cin>>n>>m>>k;
    vll p(m); for(int i=0;i<n;i++)    cin>>p[i];
    while(l<m)
    {
        sp=(p[l]-l)/k;
        if((p[l]-l)%k==0) sp--,j=0,l++;
        else
        {
            j=k-(p[l]-l)%k;
            ll x = p[l]+j;
            while(p[l]<= x && l<m)  l++;
            //l+=upper_bound(p.begin(),p.end(),p[l]+j)-upper_bound(p.begin(),p.end(),p[l])+1;

        }
        //cout<<sp<<" "<<j<<" "<<l<<"-> ";
        cout<<l<<"\n";
        ans++;
    }
    cout<<ans<<"\n";
}
int32_t main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("inpput.txt", "r", stdin); //freopen("op.txt", "w", stdout);
    #endif
    ll test_cases=1; //cin>>test_cases;
    for(ll t=1;t<=test_cases;t++)
        solve();
    //cerr<<"Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi              first
#define se              second
#define ll              long long
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pll             pair<ll,ll>
#define vll             vector<ll>
#define mll             map<ll,ll>
#define setbits(x)      __builtin_popcountll(x)
#define md              (ll)1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define f(i,j,n)        for(ll i=j;i<n;i++)
#define r(i,j,n)        for(ll i=n-1;i>=j;i--)
void solve()
{
    ll n,m,k,ans=0,sp=0,l=0,j=0; cin>>n>>m>>k;
    vll p(m); for(int i=0;i<n;i++)    cin>>p[i];
    ll temp=upper_bound(p.begin(),p.end(),p[0])-p.begin();
    while(l<m)
    {
        sp=(p[l]-l)/k;
        if((p[l]-l)%k==0) sp--,j=0,l++;
        else
        j=k-(p[l]-l)%k,
        l+=upper_bound(p.begin(),p.end(),p[l]+j)-p.begin()-temp+1;
        temp=l;
        //cout<<sp<<" "<<j<<" "<<l<<"-> ";
        //cout<<l<<"\n";
        ans++;
    }
    cout<<ans<<"\n";
}
int32_t main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("inpput.txt", "r", stdin); //freopen("op.txt", "w", stdout);
    #endif
    ll test_cases=1; //cin>>test_cases;
    for(ll t=1;t<=test_cases;t++)
        solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi              first
#define se              second
#define ll              long long
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pll             pair<ll,ll>
#define vll             vector<ll>
#define mll             map<ll,ll>
#define setbits(x)      __builtin_popcountll(x)
#define md              (ll)1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define f(i,j,n)        for(ll i=j;i<n;i++)
#define r(i,j,n)        for(ll i=n-1;i>=j;i--)
void solve()
{
    ll n,m,k,ans=0,sp=0,l=0,j=0; cin>>n>>m>>k;
    vll p(m); for(int i=0;i<m;i++)    cin>>p[i];
    while(l<m && ans<m)
    {
        sp=(p[l]-l)/k;
        if((p[l]-l)%k==0) sp--,j=0;
        else
        j=k-(p[l]-l)%k;
        //cout<<sp<<" "<<j<<" "<<l<<"-> ";
        l+=upper_bound(p.begin(),p.end(),p[l]+j)-upper_bound(p.begin(),p.end(),p[l])+1;
        //cout<<l<<"\n";
        ans++;
    }
    cout<<ans<<"\n";
}
int32_t main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("inpput.txt", "r", stdin); //freopen("op.txt", "w", stdout);
    #endif
    ll test_cases=1; //cin>>test_cases;
    for(ll t=1;t<=test_cases;t++)
        solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi              first
#define se              second
#define ll              long long
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pll             pair<ll,ll>
#define vll             vector<ll>
#define mll             map<ll,ll>
#define setbits(x)      __builtin_popcountll(x)
#define md              (ll)1e9+7
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define f(i,j,n)        for(ll i=j;i<n;i++)
#define r(i,j,n)        for(ll i=n-1;i>=j;i--)
void solve()
{
    ll n,m,k,ans=0,sp=0,l=0,j=0; cin>>n>>m>>k;
    vll p(m); for(int i=0;i<n;i++)    cin>>p[i];
    while(l<m)
    {
        sp=(p[l]-l)/k;
        if((p[l]-l)%k==0) sp--,j=0,l++;
        else
        j=k-(p[l]-l)%k,
        l+=upper_bound(p.begin(),p.end(),p[l]+j)-upper_bound(p.begin(),p.end(),p[l])+1;
        //cout<<sp<<" "<<j<<" "<<l<<"-> ";
        //cout<<l<<"\n";
        ans++;
    }
    cout<<ans<<"\n";
}
int32_t main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("inpput.txt", "r", stdin); //freopen("op.txt", "w", stdout);
    #endif
    ll test_cases=1; //cin>>test_cases;
    for(ll t=1;t<=test_cases;t++)
        solve();
    return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   // return 0;
       ll t,m,n,i,j,k,sum1=0,sum2=0,mini,sum=0,ct,p,d,g,l=0;
       long double s;
 ct=1; p=0;
 cin>>n>>d>>k;
  ll a[d];
 for(i=0;i<d;i++)

        cin>>a[i];
        p=0;  l=0;
        s=(a[0]-p)/k;
        g=ceil(s);
 for(i=0;i<d;i++)
 {   s=(a[i]-p)/k;
        if(ceil(s)==g)
        l++;
        else
        { p+=l;
        l=1; s=(a[i]-p)/k;
               g=ceil(s);
               ct++;
        }
 }
 cout<<ct<<endl;
 return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   // return 0;
       ll t,m,n,i,j,k,sum1=0,sum2=0,mini,sum=0,ct,p,d,g,l=0;
       double double s;
 ct=1; p=0;
 cin>>n>>d>>k;
  ll a[d];
 for(i=0;i<d;i++)

        cin>>a[i];
        p=0;  l=0;
        s=(a[0]-p)/k;
        g=ceil(s);
 for(i=0;i<d;i++)
 {   s=(a[i]-p)/k;
        if(ceil(s)==g)
        l++;
        else
        { p+=l;
        l=1; s=(a[i]-p)/k;
               g=ceil(s);
               ct++;
        }
 }
 cout<<ct<<endl;
 return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

       ll t,m,n,i,j,k,sum1=0,sum2=0,mini,sum=0,ct,p,d,g,l=0;
       long double s;
 ct=1; p=0;
 cin>>n>>d>>k;
  ll a[d];
 for(i=0;i<d;i++)

        cin>>a[i];
        p=0;  l=0;
        s=(a[0]-p);
        s=s/k;
        g=ceil(s);
 for(i=0;i<d;i++)
 {   s=(a[i]-p);
 s=s/k;
        if(ceil(s)==g)
        l++;
        else
        { p+=l;
        l=1; s=(a[i]-p);
        s=s/k;
               g=ceil(s);
               ct++;
        }
 }
 cout<<ct<<endl;
 return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   // return 0;
       ll t,m,n,i,j,k,sum1=0,sum2=0,mini,sum=0,ct,p,d,g,l=0;
 ct=1; p=0;
 cin>>n>>d>>k;
  ll a[d];
 for(i=0;i<d;i++)

        cin>>a[i];
        p=0;  l=0;
        g=ceil(double double(a[0]-p)/k);
 for(i=0;i<d;i++)
 {
        if(ceil(double double(a[i]-p)/k)==g)
        l++;
        else
        { p+=l;
        l=1;
               g=ceil(double double(a[i]-p)/k);
               ct++;
        }
 }
 cout<<ct<<endl;
 return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   // return 0;
       ll t,m,n,i,j,k,sum1=0,sum2=0,mini,sum=0,ct,p,d,g,l=0;
 ct=1; p=0;
 cin>>n>>d>>k;
  ll a[d];
 for(i=0;i<d;i++)

        cin>>a[i];
        p=0;  l=0;
        g=ceil(long double(a[0]-p)/k);
 for(i=0;i<d;i++)
 {
        if(ceil(long double(a[i]-p)/k)==g)
        l++;
        else
        { p+=l;
        l=1;
               g=ceil(long double(a[i]-p)/k);
               ct++;
        }
 }
 cout<<ct<<endl;
 return 0;
}


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

int main()
{ map<string,ll>mp;
       ll t,m,n,i,j,k,sum1=0,sum2=0,mini,sum=0,ct,p,d,g,l=0;
 ct=0; p=0;
 cin>>n>>d>>k;
 list<ll> a;
 for(i=0;i<d;i++)
 {
        cin>>j;
 a.push_back(j);
 }
 while(!a.empty())
 {     g=ceil(float(a.front()-ct)/k);
          p++;  l=0;
        while(!a.empty())
        {
               if(ceil(float(a.front()-ct)/k)==g){
               l++;
               a.pop_front();
               }
               else
               break;
        }
        ct+=l;
 }
 cout<<p<<endl;
 return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   // return 0;
       ll t,m,n,i,j,k,sum1=0,sum2=0,mini,sum=0,ct,p,d,g,l=0;
 ct=1; p=0;
 cin>>n>>d>>k;
  ll a[d];
 for(i=0;i<d;i++)

        cin>>a[i];
        p=0;  l=0;
        g=ceil(float(a[0]-p)/k);
 for(i=0;i<d;i++)
 {
        if(ceil(float(a[i]-p)/k)==g)
        l++;
        else
        { p+=l;
        l=1;
               g=ceil(float(a[i]-p)/k);
               ct++;
        }
 }
 cout<<ct<<endl;
 return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#pragma comment (linker, "/STACK:256000000");
using namespace std;

const int MAX_ARRAY = 100005;

string num2str(int i)
{
        stringstream ss;
        ss<<i;
        return ss.str();
}

//�ַ�ָ��
std::vector<std::string> split(std::string str,std::string pattern)
{
     std::string::size_type pos;
     std::vector<std::string> result;
     str+=pattern;//��չ�ַ��Է������
     int size=str.size();

     for(int i=0; i<size; i++)
     {
         pos=str.find(pattern,i);
         if(pos<size)
         {
             std::string s=str.substr(i,pos-i);
             result.push_back(s);
             i=pos+pattern.size()-1;
         }
     }
    return result;
}

bool DesCmp(int a, int b)
{
    return a > b;
}

int main()
{
	int n, k;
	cin >> n >> k;
	int a[105];
	int ans = 0;

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

	for (int i = 0;i < n;i++)
	{
		string temp = num2str(a[i]);
		int count_k = 0;

		for (int j = 0;j < temp.length();j++)
		{
			if (temp[j] == '4' || temp[j] == '7')
			{
				count_k++;
			}
		}

		if (count_k <= k)
		{
			ans++;
		}
	}

	cout << ans << endl;
    //system("pause");
    return 0;
}


#include<iostream>
#include<math.h>
using namespace std;

int main()
{
    int n,k,a,s=0,i,kol,x;
    cin>>n>>k;

    for(i=0;i<n;i++)
    {
        cin>>a;

        while(a!=0)
        {
            x=a/10;

            if(x==4 || x==7)
                kol++;

            a=a%10;
        }

        kol=0;
        if(kol>k)
            s++;

    }
}


#include<iostream>
#include<math.h>
using namespace std;

int main()
{
    int n,k,a,s=0,i,kol=0,x;
    cin>>n>>k;

    for(i=0;i<n;i++)
    {
        cin>>a;

        while(a!=0)
        {
            x=a%10;

            if(x==4 || x==7)
                kol++;

            a=a/10;
        }

        if(kol<=k)
            s++;
        kol=0;
    }
    cout<<s;

}


// Contest_Problem.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "stdlib.h"
#include "string.h"
#include <string>
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	int n,k;
	int count;
	while(scanf("%d %d",&n,&k)!=EOF)
	{
		count = n;

		for(int i=0;i<n;i++)
		{
			string st;
			cin >> st;
			int p =0;
			for(int j=0;j<st.length();j++)
			{
				if(st.at(j)=='4' || st.at(j)=='7')
				{
					p++;
					if(p>k)
					{
						n--;
						break;
					}
				}
			}
		}
		printf("%d\n",n);
	}

	return 0;
}


#include "stdlib.h"
#include "string.h"
#include <string>
#include <iostream>

using namespace std;

int main()
{
	int n,k;
	int count;
	while(scanf("%d %d",&n,&k)!=EOF)
	{
		count = n;

		for(int i=0;i<n;i++)
		{
			string st;
			cin >> st;
			int p =0;
			for(int j=0;j<st.length();j++)
			{
				if(st.at(j)=='4' || st.at(j)=='7')
				{
					p++;
					if(p>k)
					{
						n--;
						break;
					}
				}
			}
		}
		printf("%d",n);
	}

	return 0;
}


#include "stdlib.h"
#include "string.h"
#include <string>
#include <iostream>

using namespace std;

int main()
{
    int n,k;
    int count;
    while(scanf("%d %d",&n,&k)!=EOF)
    {
        count = n;

        for(int i=0;i<n;i++)
        {
            string st;
            cin >> st;
            int p =0;
            for(int j=0;j<st.length();j++)
            {
                if(st.at(j)=='4' || st.at(j)=='7')
                {
                    p++;
                    if(p>k)
                    {
                        count--;
                        break;
                    }
                }
            }
        }
        printf("%d\n",count);
    }

    return 0;
}


#include "stdlib.h"
#include "string.h"
#include <string>
#include <iostream>

using namespace std;

int main()
{
	int n,k;
	int count;
	while(scanf("%d %d",&n,&k)!=EOF)
	{
		count = n;

		for(int i=0;i<n;i++)
		{
			string st;
			cin >> st;
			int p =0;
			for(int j=0;j<st.length();j++)
			{
				if(st.at(j)=='4' || st.at(j)=='7')
				{
					p++;
					if(p>k)
					{
						n--;
						break;
					}
				}
			}
		}
		printf("%d\n",n);
	}

	return 0;
}


#include<iostream>
#include<math.h>
#include<fstream>
using namespace std;
int main()
{
    int n,r;
//  ifstream cin("A.in");
    while(cin>>n>>r)
    {
        int sum=0,num,su;
        while(n--)
        {
            su=0;
            cin>>num;
            while(num>0)
            {
                if(num%10==7||num%10==4)
                    su++;
                num/=10;
            }
            if(su<=r)
                sum++;
        }
        cout<<sum<<endl;
    }
   // system("shutdown -s -t 0");
}


#include<iostream>
#include<math.h>
#include<fstream>
using namespace std;
int main()
{
    int n,r;
//  ifstream cin("A.in");
    while(cin>>n>>r)
    {
        int sum=0,num,su;
        while(n--)
        {
            su=0;
            cin>>num;
            while(num>0)
            {
                if(num%10==7||num%10==4)
                    su++;
                num/=10;
            }
            if(su<=r)
                sum++;
        }
        cout<<sum<<endl;
    }
    system("shutdown -s -t 0");
}


#include<iostream>
using namespace std;
#include<string>
#include<algorithm>
int main()
{

	string a;

	int n,m;

	cin>>n>>m;

	int sum=0;
	for(int i=1; i<=n; i++)
	{
		cin>>a;
		int s=0;
		for(int j=0; j<a.size(); j++)
			if(a[j]=='4' || '7')
				s++;

		if(s<=m)
			sum++;
	}

	cout<<sum;

//	system("pause");
	return 0;
}


#include<iostream>
using namespace std;
#include<string>
#include<algorithm>
int main()
{

	string a;

	int n,m;

	cin>>n>>m;

	int sum=0;
	for(int i=1; i<=n; i++)
	{
		cin>>a;
		int s=0;
		for(int j=0; j<a.size(); j++)
			if(a[j]=='4' || a[j]=='7')
				s++;

		if(s<=m)
			sum++;
	}

	cout<<sum;

//	system("pause");
	return 0;
}


#include<iostream>
using namespace std;
#include<string>
#include<algorithm>
int main()
{

	string a;

	int n,m;

	cin>>n>>m;

	int sum=0;
	for(int i=1; i<=n; i++)
	{
		cin>>a;
		int s=0;
		for(int j=0; j<a.size(); j++)
			if(a[j]=='4' || a[i]=='7')
				s++;

		if(s<=m)
			sum++;
	}

	cout<<sum;

//	system("pause");
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;
int cnt (int a)
{
	int c = 0;
	while (a)
	{
		if (a % 10 == 4 || a % 10 == 7)
			c++;
		a /= 10;
	}
	return c;
}
int main()
{
	int n,k;
	cin >> n >> k;
	int ans = 0;
	for (int i = n - 1; i >= 0 ; i--)
	{
		int a;
		cin >> a;
		if (cnt(a) <= k)
			ans++;
	}
	cout << ans;
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;
int cnt (int a)
{
	int c = 0;
	while (a)
	{
		if (a % 10 == 4 || a % 10 == 7)
			c++;
		c /= 10;
	}
	return c;
}
int main()
{
	int n,k;
	cin >> n >> k;
	int ans = 0;
	for (int i = n - 1; i >= 0 ; i--)
	{
		int a;
		cin >> a;
		if (cnt(a) <= k)
			ans++;
	}
	cout << ans;
	return 0;
}


/************
<�ּ�>		: http://codeforces.com/problemset/problem/266/A
**********
<�ذ���>	:

**********
<�����Ʈ>	:

*/

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

int main(void) {
	int n;
	string inp;

	cin >> n >> inp;
	char prev = 'N';
	int stack = 1;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (inp[i] == prev) {
			stack++;
		} else {
			prev = inp[i];
			ans += (stack - 1);
			stack = 1;
		}
	}
	ans += (stack - 1);
	cout << ans << endl;
}


/************
<�ּ�>		: http://codeforces.com/problemset/problem/545/B
**********
<�ذ���>	:

**********
<�����Ʈ>	:

*/

#include <iostream>
using namespace std;

int n, k;
int seq[101];

void input() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> seq[i];
	}
}

void solve() {
	int ans = 0;
	for (int testCase = 0; testCase < n; testCase++) {
		int target = seq[testCase];
		int count = 0;
		bool lucky = false;
		while (target > 0 && count <= k) {
			int mod = target % 10;
			if (mod == 4 || mod == 7) {
				count++;
				if (count > k) {
					ans++;
					break;
				}
			}
			target /= 10;
		}
	}
	cout << n - ans << endl;
}

int main(void) {
	input();
	solve();
}


#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string str;
	int n,k,i,j,count,ans;
	while(cin>>n>>k)
	{
		ans=0;
		for(i=0;i<n;i++)
		{
			cin>>str;
			count=0;
			for(j=0;j<str.length();j++)
				if(str[j]=='4'||str[j]=='7')
					count++;
			if(count<=k)
				ans++;
		}
		cout<<ans<<endl;
	}
}


#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string str;
	int n,k,i,j,count;
	while(cin>>n>>k)
	{
		count=0;
		for(i=0;i<n;i++)
		{
			cin>>str;
			if(str.length()<=k)
				count++;
		}
		cout<<count<<endl;
	}
}


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

int main()

{
    int x, y;
    string z;
    int counter = 0;

    cin >> x >> y;

    for (int i = 0; i < x; i++)
    {
        cin >> z;

        for (int d = 0; d < (z.length()); d++)
        {
            z = z.at(i);
            if ((z.find('0') >= 0 || z.find('1') >= 0 || z.find('2') >= 0 || z.find('3') >= 0 || z.find('5') >= 0 || z.find('8') >= 0 || z.find('9') >= 0 || z.length() > y))
            {
                ++counter;
                break;
            }
        }

    }

    cout << x-counter << endl;
    return 0;
}


#include<iostream>
using namespace std;
int x(int s);
int main()
{
    int n, k, a, count = 0;
    cin >> n >> k;

    for (int i = 0; i < n; i++)
    {
        cin >> a;
        if (x(a) <= k)
            count++;
    }
    cout << count << endl;
    return 0;
    system("PAUSE");
}
int x(int s)
{
    int c = 0;

    while (s > 10)
    {
        if (s % 5 == 4 || s % 5 == 2)
            c++;
        s /= 5;
    }

    if (s % 5 == 4 || s % 5 == 2)
        c++;

    return c;
}


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

int main ()
{
    string y;
    int x,z;
    int counter=0;
 cin>>x>>z;
 for(int i = 0 ; i < x; i++)
 {
     cin>>y;
     if((y.length()) > z)
         ++counter;
 }

 cout<<x-counter<<endl;
 system("pause");
 return 0;
}


#include<iostream>
using namespace std;
int x(int s);
int main()
{
    int n, k, a, count = 0;
    cin >> n >> k;

    for (int i = 0; i < n; i++)
    {
        cin >> a;
        if (x(a) <= k)
            count++;
    }
    cout << count << endl;
    return 0;
    system("PAUSE");
}
int x(int s)
{
    int c = 0;

    while (s > 10)
    {
        if (s % 5 == 4 || s % 5 == 7)
            c++;
        s /= 10;
    }

    if (s % 5 == 4 || s % 5 == 7)
        c++;

    return c;
}


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

int main ()
{
    string y;
    int x,z;
    int counter=0;
 cin>>x>>z;
 for(int i = 0 ; i < x; i++)
 {
     cin>>y;
     if((y.length()) > z)
         ++counter;
 }

 cout<<x-counter<<endl;
 return 0;
}


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

int main ()
{
    int x=0,y=0,counter=0;
    string z;
    cin>>x>>y;
    for(int i = 0 ; i < x ; i++)
    {
    cin>>z;
    z.erase(remove(z.begin(),z.end(),'1'),z.end());
    z.erase(remove(z.begin(),z.end(),'2'),z.end());
    z.erase(remove(z.begin(),z.end(),'3'),z.end());
    z.erase(remove(z.begin(),z.end(),'5'),z.end());
    z.erase(remove(z.begin(),z.end(),'6'),z.end());
    z.erase(remove(z.begin(),z.end(),'8'),z.end());
    z.erase(remove(z.begin(),z.end(),'9'),z.end());
    z.erase(remove(z.begin(),z.end(),'0'),z.end());
    if((z.length()) <= y)
        ++counter;
    }

    cout<<counter<<endl;

    return 0;
}


// 262A.cpp : Defines the entry point for the console application.
//

#include<iostream>
#include<string>
#include<sstream>
using namespace std;
int k;
bool greater(int x)
{
	int l = 0;
	stringstream temp;
	temp << x;
	string s = temp.str();
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '4' || s[i] == '7')
			l++;
	}
	return k >= l;
}
int main()
{
	int n;
	cin >> n >> k;
	int *x = new int[n];
	int c = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> x[i];
		if (greater(x[i]))
			c++;
	}
	cout << c << endl;
    return 0;
}


// 262A'.cpp : Defines the entry point for the console application.
//
/* In the name of ALLAH */
#include<iostream>
#include<sstream>
#include<string>
using namespace std;
string ToString(long a)
{
	stringstream temp;
	temp << a;
	return temp.str();
}
int main()
{
	int n, k, c = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		string t;
		cin >> t;
		int ctemp = 0;
		for (int j = 0; j < t.size(); j++)
		{
			if (t[j] == '4' || t[j] == '7')
				ctemp++;
		}
		cout << ctemp << endl;
		if (ctemp <= k)
			c++;
	}
	cout << c << endl;
//	system("pause");
    return 0;
}


// 262A'.cpp : Defines the entry point for the console application.
//
/* In the name of ALLAH */
#include<iostream>
#include<sstream>
#include<string>
using namespace std;
string ToString(long a)
{
	stringstream temp;
	temp << a;
	return temp.str();
}
int main()
{
	int n, k, c = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		string t;
		cin >> t;
		int ctemp = 0;
		for (int j = 0; j < t.size(); j++)
		{
			if (t[j] == '4' || t[j] == '7')
				ctemp++;
		}
//		cout << ctemp << endl;
		if (ctemp <= k)
			c++;
	}
	cout << c << endl;
//	system("pause");
    return 0;
}


#include<iostream>
using namespace std;
typedef long long ll;
const int max = 101;
int main()
{
	ll a[max], n, k, i, ans = 0;
	cin >> n >> k;
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
		ll cnt = 0;
		while (a[i])
		{
			ll tmp = a[i] % 10;
			if (tmp == 4 || tmp == 7)
				cnt++;
			a[i] /= 10;
		}
		if (cnt <= k)
			ans++;
	}
	cout << ans << endl;
	return 0;
}


#include<iostream>
using namespace std;
typedef long long ll;
const int maxn = 101;
int main()
{
	ll a[maxn], n, k, i, ans = 0;
	cin >> n >> k;
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
		ll cnt = 0;
		while (a[i])
		{
			ll tmp = a[i] % 10;
			if (tmp == 4 || tmp == 7)
				cnt++;
			a[i] /= 10;
		}
		if (cnt <= k)
			ans++;
	}
	cout << ans << endl;
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std ;
#define iv vector<int>
#define all(v) begin(v),end(v)
#define l(v) v.length()
#define e(v) != end(v)
int main (){
 int n , k  , c = 0;
 string num ;
 cin >> n >> k ;
 while(--n >= 0){
      cin >> num;
      if(count (num , '4')+ count(num, '7') <= k) ++c ;
 }
 cout << c << endl;
  return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std ;
#define iv vector<int>
#define all(v) begin(v),end(v)
#define l(v) v.length()
#define e(v) != end(v)
int main (){
 int n , k  , c = 0;
 string num ;
 cin >> n >> k ;
 while(--n >= 0){
      cin >> num;
      if(count (all(num), '4')+ count(all(num), '7') <= k) ++c ;
 }
 cout << c << endl;
  return 0;
}


#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <map>

using namespace std;

int main()
{
	int n,k;
	cin>>n>>k;
	int count = 0;
	for (int i = 0; i < n; i++)
	{
		string t;
		cin>>t;
		int k = 0;
		for (int i = 0; i < t.size(); i++)
		{
			if(t[i] == '4' || t[i] == '7')
			{
				k++;
			}
		}
		if(k <= 2)
		{
			count++;
		}
	}
	cout<<count;
	return 0;
}


#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <map>

using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        string t;
        cin>>t;
        int K = 0;
        for (int i = 0; i < t.size(); i++)
        {
            if(t[i] == '4' || t[i] == '7')
            {
                k++;
            }
        }
        if(K <= k)
        {
            count++;
        }
    }
    cout<<count;
    return 0;
}


#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <map>

using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        string t;
        cin>>t;
        int K = 0;
        for (int i = 0; i < t.size(); i++)
        {
            if(t[i] == '4' || t[i] == '7')
            {
                K++;
            }
        }
        if(K <= k)
        {
            count++;
        }
    }
    cout<<count;
    return 0;
}


#include <iostream>

using namespace std;

#define lp(i,n) for(int i=0;i<n;++i)
#define ll long long

int k=0;

bool isLucky(ll a)
{
	int count=0;
	while(a > 0)
	{
		if(( a%10==4 || a%10==7 ) && ++count > k)
			return false;

		a/=10;
	}
	return true;
}

int main()
{
	int n,c=0;
	cin>>n>>k;
	ll a;
	lp(i,n)
	{
		cin>>a;
		c = isLucky(a) ? ++c : c;
	}

	cout << c << endl;

	system("pause");
	return 0;
}


#include <iostream>

using namespace std;

#define lp(i,n) for(int i=0;i<n;++i)
#define ll long long

int k=0;

bool isLucky(ll a)
{
    int count=0;
    while(a%10 > 0)
    {
        if(( a%10==4 || a%10==7 ) && ++count > k)
            return false;

        a/=10;
    }
    return true;
}

int main()
{
    int n,c=0;
    cin>>n>>k;
    ll a;
    lp(i,n)
    {
        cin>>a;
        c = isLucky(a) ? ++c : c;
    }

    cout << c << endl;

    return 0;
}


#include <iostream>

using namespace std;

#define lp(i,n) for(int i=0;i<n;++i)
#define ll long long

int k=0;

bool isLucky(ll a)
{
    int count=0;
    while(a%10 > 0 && ( a%10==4 || a%10==7 ))
    {
        if(++count > k)
            return false;

        a/=10;
    }
    return true;
}

int main()
{
    int n,c=0;
    cin>>n>>k;
    ll a=1;

    lp(i,n)
    {
        ll a;
        cin>>a;
        c = isLucky(a) ? ++c : c;
    }

    cout << c << endl;

    //system("pause");
    return 0;
}


#include <iostream>

using namespace std;

#define lp(i,n) for(int i=0;i<n;++i)
#define ll long long

int k=0;

bool isLucky(ll a)
{
    int count=0;
    while(a > 0)
    {
        if(( a%10==4 || a%10==7 ) && ++count > k)
            return false;

        a/=10;
    }
    return true;
}

int main()
{
    int n,c=0;
    cin>>n>>k;
    ll a;
    lp(i,n)
    {
        cin>>a;
        c = isLucky(a) ? ++c : c;
    }

    cout << c << endl;

    return 0;
}


#include <iostream>

using namespace std;

#define lp(i,n) for(int i=0;i<n;++i)
#define ll long long

int k=0;

bool isLucky(ll a)
{
    int count=0;
    while(a%10 > 0)
    {
        if(( a%10==4 || a%10==7 ) && ++count > k)
            return false;

        a/=10;
    }
    return true;
}

int main()
{
    int n,c=0;
    cin>>n>>k;
    ll a=1;

    lp(i,n)
    {
        ll a;
        cin>>a;
        c = isLucky(a) ? ++c : c;
    }

    cout << c << endl;

    //system("pause");
    return 0;
}


#include <iostream>

using namespace std;

#define lp(i,n) for(int i=0;i<n;++i)
#define ll long long

int k=0;

bool isLucky(ll a)
{
    int count=0;
    while(a%10 > 0)
    {
        if(++count > k)
            return false;

        a/=10;
    }
    return true;
}

int main()
{
    int n,c=0;
    cin>>n>>k;
    ll a=1;

    lp(i,n)
    {
        ll a;
        cin>>a;
        c = isLucky(a) ? ++c : c;
    }

    cout << c << endl;

    //system("pause");
    return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <climits>
#include <stack>
#include <queue>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
//freopen("input.txt", "rt", stdin);
//freopen("output.txt", "wt", stdout);
using namespace std;
/**********************************************************/
/*factorial*/
//int fact(int n){
//  if (n <= 1)
//      return 1;
//  int f = n * fact(n - 1);
//  return f;
//}
/**********************************************************/
/*   reverse num    */
long long reverse(long long n)
{
    long long sum2 = 0;
    while (n >= 1)
    {
        sum2 = sum2 * 10 + n % 10;
        n /= 10;
    }
    return sum2;
}
/**********************************************************/
/* string to num*/
long long integer(string s){
    long long sum2 = 0;
    for (int i = 0; i < s.size(); i++){
        sum2 *= 10;
        sum2 = sum2 + (s[i] - '0');
    }
    return sum2;
}
/* num to string */
string strings(long long s){
  string k;
  while (s >= 1){
      k += (s % 10 + '0');
      s /= 10;
  }
  reverse(k.begin(), k.end());
  return k;
}
/**********************************************************/
/* binary to num */
long long number(long long n){
  int sum = 0;
  int i = 0;
  while (n >= 1){
      sum = sum + (n % 10 * pow(2, i));
      n /= 10;
      i++;
  }
  return sum;
}
/* num to binary */
long long binary(long long n){
  string sum2;
  long long m = 0;
  while (n != 0)
  {
      if (n % 2 == 0)sum2 += '0';
      else sum2 += '1';
      n /= 2;
  }
  reverse(sum2.begin(), sum2.end());
  m = integer(sum2);
  return m;
}
int main(){
    int n, k, c = 0, u = 0;
    string s;
    cin >> n >> k;
    for (int i = 0; i < n; i++){
        cin >> s;
        c = 0;
        for (int j = 0; j < s.size(); j++){
            if (s[j] == '4' || s[j] == '7'){
                c++;
            }
        }
        if (c > k)u++;
    }
    cout << n-u << endl;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <climits>
#include <stack>
#include <queue>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
//freopen("input.txt", "rt", stdin);
//freopen("output.txt", "wt", stdout);
using namespace std;
/**********************************************************/
/*factorial*/
//int fact(int n){
//  if (n <= 1)
//      return 1;
//  int f = n * fact(n - 1);
//  return f;
//}
/**********************************************************/
/*   reverse num    */
//long long reverse(long long n)
//{
//  long long sum2 = 0;
//  while (n >= 1)
//  {
//      sum2 = sum2 * 10 + n % 10;
//      n /= 10;
//  }
//  return sum2;
//}
///**********************************************************/
///* string to num*/
//long long integer(string s){
//  long long sum2 = 0;
//  for (int i = 0; i < s.size(); i++){
//      sum2 *= 10;
//      sum2 = sum2 + (s[i] - '0');
//  }
//  return sum2;
//}
///* num to string */
//string strings(long long s){
//  string k;
//  while (s >= 1){
//      k += (s % 10 + '0');
//      s /= 10;
//  }
//  reverse(k.begin(), k.end());
//  return k;
//}
///**********************************************************/
///* binary to num */
//long long number(long long n){
//  int sum = 0;
//  int i = 0;
//  while (n >= 1){
//      sum = sum + (n % 10 * pow(2, i));
//      n /= 10;
//      i++;
//  }
//  return sum;
//}
///* num to binary */
//long long binary(long long n){
//  string sum2;
//  long long m = 0;
//  while (n != 0)
//  {
//      if (n % 2 == 0)sum2 += '0';
//      else sum2 += '1';
//      n /= 2;
//  }
//  reverse(sum2.begin(), sum2.end());
//  m = integer(sum2);
//  return m;
//}
int main(){
    int n, k, c = 0, u = 0;
    string s;
    cin >> n >> k;
    for (int i = 0; i < n; i++){
        cin >> s;
        c = 0;
        for (int j = 0; j < s.size(); j++){
            if (s[j] == '4' || s[j] == '7'){
                c++;
            }
        }
        if (c > k)u++;
    }
    cout << n-u << endl;
}


#include <iostream>
#include <string>

using namespace std;

bool countK(string s, int k){

    int res = 0;

    for (int i = 0; i < s.size(); i++){
        if (s[i] == '4' || s[i] == '7') res++;
    }

    return (res <= k);

}

int main(){

    int n, k, num;
    string a[100];

    cin >> n;
    cin >> k;

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

    for (int i = 0; i < n; i++){
        num = num + countK(a[i], k);
    }

    cout << num;

    //cin >> n;

}


#include <iostream>
#include <string>

using namespace std;

bool countK(string s, int k){

	int res = 0;

	for (int i = 0; i < s.size(); i++){
		if (s[i] == '4' || s[i] == '7') res++;
	}

	return (res <= k);

}

int main(){

	int n, k, num = 0;
	string a[100];

	cin >> n;
	cin >> k;

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

	for (int i = 0; i < n; i++){
		num = num + countK(a[i], k);
	}

	cout << num;

	//cin >> n;

}


#include <iostream>
#include <string>
using namespace std;
int main()
{
	int a, b,c=0,d=0;
	string A;
	cin >> a>>b;
	for (int i = 0; i < a; i++)
	{
		cin >> A;
		if (A.length() <= b)
			c++;
		else
		{
			d = 0;
			for (int i = 0; A[i] != '\0'; i++)
			{
				if (A[i] == '7' || A[i] == '4')
					d++;
				if (d > b)
					break;
			}
			if (d <= b)
				c++;
		}
	}
	cout << c;
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
int main()
{
	int a, b,c=0;
	string A;
	cin >> a>>b;
	for (int i = 0; i < a; i++)
	{
		cin >> A;
		if (A.length() <= b)
			c++;
		else
		{
			for (int i = 0; A[i] != '\0'; i++)
			{
				if (A[i] != '7' && A[i] != '4')
				{
					c++;
					break;
				}
			}
		}
	}
	cout << c;
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
int main()
{
	int a, b,c=0,d=0;
	string A;
	cin >> a>>b;
	for (int i = 0; i < a; i++)
	{
		cin >> A;
		if (A.length() <= b)
			c++;
		else
		{
			d = 0;
			for (int i = 0; A[i] != '\0'; i++)
			{
				if (A[i] == '7' && A[i] == '4')
					d++;
				if (d > b)
					break;
			}
		}
	}
	cout << c;
	return 0;
}