#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

string s;

string Replace( string s1, string s2, string s3 )
{
    string :: size_type  pos( s1.find( s2 ) );
    while( pos != string :: npos )
    {
        s1.replace( pos, s2.size(), s3 );
        pos = s1.find( s2, pos + s3.size() );
    }
    return s1;
}

signed main()
{
    int n = 0;
    scanf( "%d\n", &n );
    while( 0 < n )
    {
        getline( cin, s );
        s = Replace( s, "Hoshino", "Hoshina" );
        cout << s << endl;
        n--;
    }
    return 0;
}

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    vi A(N),B(N),C(N);
    rep(i,N) cin>>A[i];
    rep(i,N) cin>>B[i];
    rep(i,N) cin>>C[i];
    sort(all(A));
    sort(all(B));
    sort(all(C));
    ll ans=0;
    rep(i,N){
        int a = lower_bound(all(A),B[i])-A.begin();
        int c = C.end()-upper_bound(all(C),B[i]);
        ans += (ll)a*c;
    }
    cout<<ans<<"\n";
    return 0;
}
