#include <bits/stdc++.h>
using namespace std;
int n;
string s;
struct info {
  unsigned int fi, se, type = 0;
};
unsigned int ipb[200005], ipw[200005];
vector<info> ip;
vector<string> ans;
vector<pair<unsigned int, unsigned int> > range;
bool comp(info a, info b) { return (a.se == b.se ? a.fi > b.fi : a.se < b.se); }
pair<unsigned int, unsigned int> convert(string s) {
  unsigned int res = 0;
  unsigned int cur = 0;
  unsigned int cnt = 1;
  unsigned int bit = 0;
  for (int i = 0; i < 4; i++) {
    while (s[cnt] - '.' != 0 && s[cnt] - '/' != 0 && cnt < s.length()) {
      cur *= 10;
      cur += s[cnt] - '0';
      cnt++;
    }
    res += cur * (1 << (8 * (3 - i)));
    cur = 0;
    cnt++;
  }
  if (cnt >= s.length()) bit = 32;
  while (cnt < s.length()) {
    bit *= 10;
    bit += s[cnt] - '0';
    cnt++;
  }
  bit = 32 - bit;
  if (bit == 32) return {0, 4294967295};
  unsigned int del = (unsigned int)1 << bit;
  return {(res / del) << bit, ((res / del) << bit) + (del - 1)};
}
unsigned int get(unsigned int low, unsigned int high, unsigned int val) {
  if (low == high) return (ip[low].se > val ? low : low + 1);
  unsigned int mid = low + ((high - low) >> 1);
  if (val >= ip[mid].se)
    return get(mid + 1, high, val);
  else
    return get(low, mid, val);
}
bool check() {
  pair<unsigned int, unsigned int> b;
  pair<unsigned int, unsigned int> w;
  unsigned int cnt = 0;
  bool inb = 0, inw = 0;
  sort(ip.begin(), ip.end(), comp);
  for (auto i : ip) {
    cnt++;
    if (i.type) {
      b = {i.fi, i.se};
      inb = 1;
      ipb[cnt] = ipb[cnt - 1] + 1;
      ipw[cnt] = ipw[cnt - 1];
    } else {
      w = {i.fi, i.se};
      inw = 1;
      ipw[cnt] = ipw[cnt - 1] + 1;
      ipb[cnt] = ipb[cnt - 1];
    }
    if (inb && inw && b.second >= w.first && w.second >= b.first) return false;
  }
  return true;
}
bool all(unsigned int l, unsigned int r) {
  return ((!(ipb[r] - ipb[l - 1])) || (!(ipw[r] - ipw[l - 1])));
}
void solve(unsigned int low, unsigned int high, unsigned int mn,
           unsigned int mx) {
  if (low > high) return;
  if (all(low + 1, high + 1)) {
    if (ip[high].type) range.push_back({mn, mx});
    return;
  }
  if (ip[high].fi == mn && ip[high].se == mx) {
    if (!ip[high].type)
      return;
    else
      range.push_back({mn, mx});
    return;
  }
  if (mn == mx) return;
  unsigned int md = mn + ((mx - mn) >> 1);
  unsigned int mid = get(low, high, md);
  solve(mid, high, md + 1, mx);
  if (mid > 0) solve(low, mid - 1, mn, md);
}
void ipnize() {
  for (auto i : range) {
    unsigned int l = i.first;
    unsigned int r = i.second;
    unsigned int bit = __builtin_popcount(r - l);
    bit = 32 - bit;
    string s;
    for (int i = 0; i < 4; i++) {
      std::ostringstream ss;
      ss << (l / (1 << (8 * (3 - i))));
      s += ss.str();
      if (i < 3) s += ".";
      l %= (1 << (8 * (3 - i)));
    }
    s += "/";
    std::ostringstream ss;
    ss << bit;
    s += ss.str();
    cout << s << endl;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    info t;
    if (s[0] - '+') t.type = 1;
    t.fi = convert(s).first;
    t.se = convert(s).second;
    ip.push_back(t);
  }
  if (!check()) {
    cout << -1;
    return 0;
  }
  solve(0, n - 1, 0, 4294967295);
  cout << range.size() << endl;
  ipnize();
  return 0;
}
