#include <stdio.h>
int main() {
    int n;
    scanf("%d", &n);
    int arr[100] = {0};
    int count = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d ", &arr[i]);
    }
    int m;
    scanf("%d", &m);
    for (int i = 0; i < n; i++) {
        if (arr[i] == m) {
            arr[i] = 0;
            count++;
        }
    }
    printf("%d\n", n - count);
    for (int i = 0; i < n; i++) {
        if (arr[i] != 0) {
            printf("%d ", arr[i]);
        }
    }
}