#include <bits/stdc++.h>
using namespace std;
const int N = 10000500;
const int M = 10000000;
int f[N];
int d[N][2];
int bad[N];
int n;
int g[N];
int sz;
inline void add(string s, int k, int type) {
  int v = 0;
  for (int i = 0; i < k; ++i) {
    int x = s[i] - '0';
    if (!d[v][x]) d[v][x] = ++sz;
    v = d[v][x];
  }
  f[v] |= type;
}
vector<string> ans;
inline int dfs(int v, string s = "", int cur = 0) {
  int next_cur = cur | f[v];
  g[v] = next_cur;
  if (d[v][0]) g[v] |= dfs(d[v][0], s + '0', next_cur);
  if (d[v][1]) g[v] |= dfs(d[v][1], s + '1', next_cur);
  if (next_cur == 3) {
    cout << -1;
    exit(0);
  }
  if (g[v] == 1) {
    bad[v] = 1;
    if (d[v][0]) bad[d[v][0]] = 0;
    if (d[v][1]) bad[d[v][1]] = 0;
  }
  return g[v];
}
inline void calc(int v, string s = "") {
  if (d[v][0]) calc(d[v][0], s + '0');
  if (d[v][1]) calc(d[v][1], s + '1');
  if (bad[v]) ans.push_back(s);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  string s;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    int x = 32;
    int tmp = 0;
    vector<int> vals;
    for (int j = 1; j < s.length(); ++j) {
      if (s[j] == '.') {
        vals.push_back(tmp);
        tmp = 0;
        continue;
      }
      if (s[j] == '/') {
        vals.push_back(tmp);
        tmp = 0;
        x = atoi(s.substr(j + 1).c_str());
        break;
      }
      tmp = tmp * 10 + s[j] - '0';
    }
    if (vals.size() < 4) vals.push_back(tmp);
    int type = s[0] == '-' ? 1 : 2;
    s = "";
    for (int j = 0; j < 4; ++j) {
      for (int k = 7; k >= 0; --k)
        if ((1 << k) & vals[j])
          s += '1';
        else
          s += '0';
    }
    add(s, x, type);
  }
  dfs(0);
  calc(0);
  cout << ans.size() << "\n";
  for (string &s : ans) {
    int cnt = 0;
    while (s.length() < 32) {
      cnt++;
      s += "0";
    }
    int v = 0;
    string res = "";
    for (int i = 0; i < 32; ++i) {
      if (i % 8 == 0) v = 0;
      v = v * 2 + s[i] - '0';
      if (i % 8 == 7) {
        res += to_string(v);
        if (i != 31) res += '.';
      }
    }
    if (cnt) res += '/', res += to_string(32 - cnt);
    cout << res << '\n';
  }
  return 0;
}
