#line 2 "library/src/stream.hpp" #include #include #include #line 2 "library/src/internal/type_traits.hpp" #include #include #include #include namespace kyopro { namespace internal { /* * @ref https://qiita.com/kazatsuyu/items/f8c3b304e7f8b35263d8 */ template struct first_enabled {}; template struct first_enabled, Args...> { using type = T; }; template struct first_enabled, Args...> : first_enabled {}; template struct first_enabled { using type = T; }; template using first_enabled_t = typename first_enabled::type; template struct int_least { static_assert(dgt <= 128); using type = first_enabled_t, std::enable_if, std::enable_if, std::enable_if, std::enable_if >; }; template struct uint_least { static_assert(dgt <= 128); using type = first_enabled_t, std::enable_if, std::enable_if, std::enable_if, std::enable_if >; }; template using int_least_t = typename int_least::type; template using uint_least_t = typename uint_least::type; template using double_size_uint_t = uint_least_t<2 * std::numeric_limits::digits>; template using double_size_int_t = int_least_t<2 * std::numeric_limits::digits>; struct modint_base {}; template using is_modint = std::is_base_of; template using is_modint_t = std::enable_if_t::value>; // is_integral template using is_integral_t = std::enable_if_t || std::is_same_v || std::is_same_v>; }; // namespace internal }; // namespace kyopro #line 6 "library/src/stream.hpp" namespace kyopro { // read void single_read(char& c) { c = getchar_unlocked(); while (isspace(c)) c = getchar_unlocked(); } template * = nullptr> void single_read(T& a) { a = 0; bool is_negative = false; char c = getchar_unlocked(); while (isspace(c)) { c = getchar_unlocked(); } if (c == '-') is_negative = true, c = getchar_unlocked(); while (isdigit(c)) { a = 10 * a + (c - '0'); c = getchar_unlocked(); } if (is_negative) a *= -1; } template * = nullptr> void single_read(T& a) { long long x; single_read(x); a = T(x); } void single_read(std::string& str) { char c = getchar_unlocked(); while (isspace(c)) c = getchar_unlocked(); while (!isspace(c)) { str += c; c = getchar_unlocked(); } } template void read(T& x) {single_read(x);} template void read(Head& head, Tail&... tail) { single_read(head), read(tail...); } // write void single_write(char c) { putchar_unlocked(c); } template * = nullptr> void single_write(T a) { if (!a) { putchar_unlocked('0'); return; } if (a < 0) putchar_unlocked('-'), a *= -1; char s[37]; int now = 37; while (a) { s[--now] = (char)'0' + a % 10; a /= 10; } while (now < 37) putchar_unlocked(s[now++]); } template * = nullptr> void single_write(T a) { single_write(a.val()); } void single_write(const std::string& str) { for (auto c : str) { putchar_unlocked(c); } } template void write(T x) { single_write(x); } template void write(Head head, Tail... tail) { single_write(head); putchar_unlocked(' '); write(tail...); } template void put(Args... x) { write(x...); putchar_unlocked('\n'); } }; // namespace kyopro /** * @brief fastIO */ #line 2 "library/src/template.hpp" #include #define rep(i, N) for (int i = 0; i < (N); i++) #define all(x) std::begin(x), std::end(x) #define popcount(x) __builtin_popcountll(x) using i128 = __int128_t; using ll = long long; using ld = long double; using graph = std::vector>; using P = std::pair; constexpr int inf = std::numeric_limits::max() / 2; constexpr ll infl = std::numeric_limits::max() / 2; constexpr ld eps = 1e-12; const long double pi = acosl(-1); constexpr uint64_t MOD = 1e9 + 7; constexpr uint64_t MOD2 = 998244353; constexpr int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1, 0}; constexpr int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1, 0}; template constexpr inline bool chmax(T1& a, T2 b) { return a < b && (a = b, true); } template constexpr inline bool chmin(T1& a, T2 b) { return a > b && (a = b, true); } #line 3 "a.cpp" using namespace std; using namespace kyopro; int main() { int n; read(n); unordered_set ok; for (int i = 1; i < n; ++i) ok.emplace(i); { int m; read(m); int sum = 0; rep(i, m) { int a; read(a); ok.erase(sum += a); } } { int m; read(m); int sum = n; rep(i, m) { int a; read(a); ok.erase(sum -= a); } } put(ok.size()); }