#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

void main()
{
    srand(time(NULL));
    int s, n, i, difference, ans = 0, max_n = 100000;
    if(rand()%100 < 70) //in 70% of the tests
    {
        max_n = 1000;
    }
    if(rand()%100 < 30) //in 30% of the tests
    {
        max_n = 6;
    }
    do
    {
        scanf("%d", &n);
        getchar();
    } while (n < 2 || n > max_n);

    char c, first_str[4*n], second_str[4*n], text[4*n];
    
    fgets(first_str, 4*n, stdin);
    for (i = 0; first_str[i] != '\n'; i++);
    first_str[i] = ' ';
    first_str[i+1] = '\0';
    
    fgets(second_str, 4*n, stdin);
    for (i = 0; second_str[i] != '\n'; i++);
    second_str[i] = ' ';
    second_str[i+1] = '\0';
    
    i = 0;
    do
    {
        c = first_str[i];
        difference = i;
        text[i - difference] = c;
        text[i + 1 - difference] = '\0';
        while(strstr(second_str, text))
        {
            i++;
            c = first_str[i];
            /*if(c == '\0' || c == '\n')
            {
                break;
            }*/
            text[i - difference] = c;
            text[i + 1 - difference] = '\0';
        }
        ans++;
        i++;
    } while (c != '\0' && c != '\n');
    printf("\n%d\n", ans);
}