#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, x, q; cin >> n >> x >> q; int ans = 0; while(q--){ int m; cin >> m; vector a(m); for(auto &&v : a) cin >> v; sort(a.begin(), a.end()); if(binary_search(a.begin(), a.end(), x)){ ans += 2; }else{ for(int i = 0; i + 1 < m; i++){ if(a[i] == a[i + 1]){ ans++; break; } } } } cout << ans / 2; if(ans & 1){ cout << ".5"; } cout << '\n'; }